aboutsummaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2017-07-03 16:40:46 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2017-07-03 14:40:46 +0000
commit2f70a97992aefc22b56cbee13ccd2bb04c6aaa6f (patch)
treeb971b49f4f54cce7db5fb1c43c9444677e53dbe9 /gcc/predict.c
parentd31415ba1989c3d51c536fbba6a976b527213e44 (diff)
downloadgcc-2f70a97992aefc22b56cbee13ccd2bb04c6aaa6f.zip
gcc-2f70a97992aefc22b56cbee13ccd2bb04c6aaa6f.tar.gz
gcc-2f70a97992aefc22b56cbee13ccd2bb04c6aaa6f.tar.bz2
re PR rtl-optimization/81290 (ICE in update_br_prob_note)
PR middle-end/81290 * predict.c (force_edge_cold): Be more careful about propagation backward. * profile-count.h (profile_probability::guessed, profile_probability::fdo, profile_count::guessed, profile_count::fdo): New. * tree-ssa-threadupdate.c (recompute_probabilities): Result is guessed. * gcc.c-torture/compile/pr81290.c: New. From-SVN: r249924
Diffstat (limited to 'gcc/predict.c')
-rw-r--r--gcc/predict.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/predict.c b/gcc/predict.c
index 4d01bf3..2a7dbfa 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -3962,15 +3962,26 @@ force_edge_cold (edge e, bool impossible)
e2->count.apply_scale (count_sum2, count_sum);
e2->probability /= prob_comp;
}
- if (current_ir_type () != IR_GIMPLE)
+ if (current_ir_type () != IR_GIMPLE
+ && e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun))
update_br_prob_note (e->src);
}
/* If all edges out of e->src are unlikely, the basic block itself
is unlikely. */
else
{
- e->probability = profile_probability::always ();
- if (current_ir_type () != IR_GIMPLE)
+ if (prob_sum == profile_probability::never ())
+ e->probability = profile_probability::always ();
+ else
+ {
+ if (impossible)
+ e->probability = profile_probability::never ();
+ /* If BB has some edges out that are not impossible, we can not
+ assume that BB itself is. */
+ impossible = false;
+ }
+ if (current_ir_type () != IR_GIMPLE
+ && e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun))
update_br_prob_note (e->src);
if (e->src->count == profile_count::zero ())
return;