Commit 02307675 by J"orn Rennecke Committed by Joern Rennecke

coverage.c (get_coverage_counts): Give a different message if flag_guess_branch_prob is set.

	* coverage.c (get_coverage_counts): Give a different message
	if flag_guess_branch_prob is set.
	* predict.c (counts_to_freqs): Return an int.
	(estimate_bb_frequencies): If counts_to_freqs returns zero,
	calculate estimates.

From-SVN: r76741
parent e300e74f
2004-01-27 J"orn Rennecke <joern.rennecke@superh.com>
* coverage.c (get_coverage_counts): Give a different message
if flag_guess_branch_prob is set.
* predict.c (counts_to_freqs): Return an int.
(estimate_bb_frequencies): If counts_to_freqs returns zero,
calculate estimates.
2004-01-27 Kazu Hirata <kazu@cs.umass.edu> 2004-01-27 Kazu Hirata <kazu@cs.umass.edu>
* config/iq2000/iq2000-protos.h: Remove the prototype for * config/iq2000/iq2000-protos.h: Remove the prototype for
......
...@@ -316,7 +316,9 @@ get_coverage_counts (unsigned counter, unsigned expected, ...@@ -316,7 +316,9 @@ get_coverage_counts (unsigned counter, unsigned expected,
static int warned = 0; static int warned = 0;
if (!warned++) if (!warned++)
inform ("file %s not found, execution counts assumed to be zero", inform ((flag_guess_branch_prob
? "file %s not found, execution counts estimated"
: "file %s not found, execution counts assumed to be zero"),
da_file_name); da_file_name);
return NULL; return NULL;
} }
......
...@@ -71,7 +71,7 @@ static void dump_prediction (enum br_predictor, int, basic_block, int); ...@@ -71,7 +71,7 @@ static void dump_prediction (enum br_predictor, int, basic_block, int);
static void estimate_loops_at_level (struct loop *loop); static void estimate_loops_at_level (struct loop *loop);
static void propagate_freq (struct loop *); static void propagate_freq (struct loop *);
static void estimate_bb_frequencies (struct loops *); static void estimate_bb_frequencies (struct loops *);
static void counts_to_freqs (void); static int counts_to_freqs (void);
static void process_note_predictions (basic_block, int *); static void process_note_predictions (basic_block, int *);
static void process_note_prediction (basic_block, int *, int, int); static void process_note_prediction (basic_block, int *, int, int);
static bool last_basic_block_p (basic_block); static bool last_basic_block_p (basic_block);
...@@ -1048,19 +1048,22 @@ estimate_loops_at_level (struct loop *first_loop) ...@@ -1048,19 +1048,22 @@ estimate_loops_at_level (struct loop *first_loop)
} }
} }
/* Convert counts measured by profile driven feedback to frequencies. */ /* Convert counts measured by profile driven feedback to frequencies.
Return nonzero iff there was any nonzero execution count. */
static void static int
counts_to_freqs (void) counts_to_freqs (void)
{ {
gcov_type count_max = 1; gcov_type count_max, true_count_max = 0;
basic_block bb; basic_block bb;
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
count_max = MAX (bb->count, count_max); true_count_max = MAX (bb->count, true_count_max);
count_max = MAX (true_count_max, 1);
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
bb->frequency = (bb->count * BB_FREQ_MAX + count_max / 2) / count_max; bb->frequency = (bb->count * BB_FREQ_MAX + count_max / 2) / count_max;
return true_count_max;
} }
/* Return true if function is likely to be expensive, so there is no point to /* Return true if function is likely to be expensive, so there is no point to
...@@ -1113,9 +1116,7 @@ estimate_bb_frequencies (struct loops *loops) ...@@ -1113,9 +1116,7 @@ estimate_bb_frequencies (struct loops *loops)
basic_block bb; basic_block bb;
sreal freq_max; sreal freq_max;
if (flag_branch_probabilities) if (!flag_branch_probabilities || !counts_to_freqs ())
counts_to_freqs ();
else
{ {
static int real_values_initialized = 0; static int real_values_initialized = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment