aboutsummaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2018-01-10 09:19:52 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2018-01-10 08:19:52 +0000
commitd89f01a08e67eb856aa03268972dbee7f4e40bd2 (patch)
tree87a7022307b8279ade8b91dba0b135afde198798 /gcc/predict.c
parent692aefcd5618a00e622a1c96957d943723040b4c (diff)
downloadgcc-d89f01a08e67eb856aa03268972dbee7f4e40bd2.zip
gcc-d89f01a08e67eb856aa03268972dbee7f4e40bd2.tar.gz
gcc-d89f01a08e67eb856aa03268972dbee7f4e40bd2.tar.bz2
re PR rtl-optimization/83575 (ICE: verify_flow_info failed (error: multiple hot/cold transitions found))
PR middle-end/83575 * predict.c (force_edge_cold): Handle in more sane way edges with no prediction. From-SVN: r256420
Diffstat (limited to 'gcc/predict.c')
-rw-r--r--gcc/predict.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/predict.c b/gcc/predict.c
index be0db6f..b6be32d 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -4040,6 +4040,10 @@ force_edge_cold (edge e, bool impossible)
edge e2;
bool uninitialized_exit = false;
+ /* When branch probability guesses are not known, then do nothing. */
+ if (!impossible && !e->count ().initialized_p ())
+ return;
+
profile_probability goal = (impossible ? profile_probability::never ()
: profile_probability::very_unlikely ());
@@ -4050,17 +4054,23 @@ force_edge_cold (edge e, bool impossible)
FOR_EACH_EDGE (e2, ei, e->src->succs)
if (e2 != e)
{
+ if (e->flags & EDGE_FAKE)
+ continue;
if (e2->count ().initialized_p ())
count_sum += e2->count ();
- else
- uninitialized_exit = true;
if (e2->probability.initialized_p ())
prob_sum += e2->probability;
+ else
+ uninitialized_exit = true;
}
+ /* If we are not guessing profiles but have some other edges out,
+ just assume the control flow goes elsewhere. */
+ if (uninitialized_exit)
+ e->probability = goal;
/* If there are other edges out of e->src, redistribute probabilitity
there. */
- if (prob_sum > profile_probability::never ())
+ else if (prob_sum > profile_probability::never ())
{
if (!(e->probability < goal))
e->probability = goal;
@@ -4100,8 +4110,7 @@ force_edge_cold (edge e, bool impossible)
update_br_prob_note (e->src);
if (e->src->count == profile_count::zero ())
return;
- if (count_sum == profile_count::zero () && !uninitialized_exit
- && impossible)
+ if (count_sum == profile_count::zero () && impossible)
{
bool found = false;
if (e->src == ENTRY_BLOCK_PTR_FOR_FN (cfun))