aboutsummaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2008-09-01 18:28:06 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2008-09-01 16:28:06 +0000
commitba623cedf4b07b3a2c2f3e638fa379bcde55c42e (patch)
treeacd38c7a826f584bcddf0792b749cd9537cd440f /gcc/predict.c
parent6a3799eb0065d62b04315aa2a9808bce71dab54b (diff)
downloadgcc-ba623cedf4b07b3a2c2f3e638fa379bcde55c42e.zip
gcc-ba623cedf4b07b3a2c2f3e638fa379bcde55c42e.tar.gz
gcc-ba623cedf4b07b3a2c2f3e638fa379bcde55c42e.tar.bz2
predict.c (maybe_hot_count_p, [...]): When profile is present, use only counts; when guessed use only frequencies.
* predict.c (maybe_hot_count_p, maybe_hot_edge_p): When profile is present, use only counts; when guessed use only frequencies. (estimate_bb_frequencies): Use function_frequency. * profile.c (compute_branch_probabilities): Exit early when profile reading failed. Set profile_status. (branch_prob): Do not set profile_status. From-SVN: r139868
Diffstat (limited to 'gcc/predict.c')
-rw-r--r--gcc/predict.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/predict.c b/gcc/predict.c
index 41a9ee3..1c877ec 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -148,7 +148,9 @@ maybe_hot_count_p (gcov_type count)
bool
maybe_hot_bb_p (const_basic_block bb)
{
- return maybe_hot_count_p (bb->count) && maybe_hot_frequency_p (bb->frequency);
+ if (profile_status == PROFILE_READ)
+ return maybe_hot_count_p (bb->count);
+ return maybe_hot_frequency_p (bb->frequency);
}
/* Return true if the call can be hot. */
@@ -178,7 +180,9 @@ cgraph_maybe_hot_edge_p (struct cgraph_edge *edge)
bool
maybe_hot_edge_p (edge e)
{
- return maybe_hot_count_p (e->count) && maybe_hot_frequency_p (EDGE_FREQUENCY (e));
+ if (profile_status == PROFILE_READ)
+ return maybe_hot_count_p (e->count);
+ return maybe_hot_frequency_p (EDGE_FREQUENCY (e));
}
/* Return true in case BB is probably never executed. */
@@ -2009,7 +2013,7 @@ estimate_bb_frequencies (void)
basic_block bb;
sreal freq_max;
- if (!flag_branch_probabilities || !counts_to_freqs ())
+ if (cfun->function_frequency != PROFILE_READ || !counts_to_freqs ())
{
static int real_values_initialized = 0;