diff options
Diffstat (limited to 'gcc/predict.c')
-rw-r--r-- | gcc/predict.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/predict.c b/gcc/predict.c index 43ee91a..60a19d7 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -1229,12 +1229,23 @@ combine_predictions_for_bb (basic_block bb, bool dry_run) if (pred->ep_probability <= PROB_VERY_UNLIKELY || pred->ep_predictor == PRED_COLD_LABEL) unlikely_edges.add (pred->ep_edge); - if (pred->ep_probability >= PROB_VERY_LIKELY - || pred->ep_predictor == PRED_BUILTIN_EXPECT - || pred->ep_predictor == PRED_HOT_LABEL) + else if (pred->ep_probability >= PROB_VERY_LIKELY + || pred->ep_predictor == PRED_BUILTIN_EXPECT + || pred->ep_predictor == PRED_HOT_LABEL) likely_edges.add (pred); } + /* It can happen that an edge is both in likely_edges and unlikely_edges. + Clear both sets in that situation. */ + for (hash_set<edge_prediction *>::iterator it = likely_edges.begin (); + it != likely_edges.end (); ++it) + if (unlikely_edges.contains ((*it)->ep_edge)) + { + likely_edges.empty (); + unlikely_edges.empty (); + break; + } + if (!dry_run) set_even_probabilities (bb, &unlikely_edges, &likely_edges); clear_bb_predictions (bb); |