aboutsummaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2017-11-17 18:47:36 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2017-11-17 17:47:36 +0000
commit650fe7323c11e5e116e34d88028909b1221e2cc8 (patch)
treec5efcdde9c45c7831beb37712307f991d8211360 /gcc/predict.c
parentdb16c1841a09f60bbdf2bb825e7e790a437f83c7 (diff)
downloadgcc-650fe7323c11e5e116e34d88028909b1221e2cc8.zip
gcc-650fe7323c11e5e116e34d88028909b1221e2cc8.tar.gz
gcc-650fe7323c11e5e116e34d88028909b1221e2cc8.tar.bz2
predict.c (determine_unlikely_bbs): Set cgraph node count to 0 when entry block was promoted unlikely.
* predict.c (determine_unlikely_bbs): Set cgraph node count to 0 when entry block was promoted unlikely. (estimate_bb_frequencies): Increase frequency scale. * profile-count.h (profile_count): Export precision info. * gcc.dg/tree-ssa/dump-2.c: Fixup template for profile precision changes. * gcc.dg/tree-ssa/pr77445-2.c: Fixup template for profile precision changes. From-SVN: r254888
Diffstat (limited to 'gcc/predict.c')
-rw-r--r--gcc/predict.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/predict.c b/gcc/predict.c
index 7404f1a..7e40f77 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -3542,6 +3542,8 @@ determine_unlikely_bbs ()
bb->index, e->dest->index);
e->probability = profile_probability::never ();
}
+ if (ENTRY_BLOCK_PTR_FOR_FN (cfun)->count == profile_count::zero ())
+ cgraph_node::get (current_function_decl)->count = profile_count::zero ();
}
/* Estimate and propagate basic block frequencies using the given branch
@@ -3565,7 +3567,11 @@ estimate_bb_frequencies (bool force)
{
real_values_initialized = 1;
real_br_prob_base = REG_BR_PROB_BASE;
- real_bb_freq_max = BB_FREQ_MAX;
+ /* Scaling frequencies up to maximal profile count may result in
+ frequent overflows especially when inlining loops.
+ Small scalling results in unnecesary precision loss. Stay in
+ the half of the (exponential) range. */
+ real_bb_freq_max = (uint64_t)1 << (profile_count::n_bits / 2);
real_one_half = sreal (1, -1);
real_inv_br_prob_base = sreal (1) / real_br_prob_base;
real_almost_one = sreal (1) - real_inv_br_prob_base;
@@ -3610,6 +3616,8 @@ estimate_bb_frequencies (bool force)
freq_max = BLOCK_INFO (bb)->frequency;
freq_max = real_bb_freq_max / freq_max;
+ if (freq_max < 16)
+ freq_max = 16;
cfun->cfg->count_max = profile_count::uninitialized ();
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun), NULL, next_bb)
{