Fix set of even probabilities (PR middle-end/89737).
2019-03-19 Martin Liska <mliska@suse.cz> PR middle-end/89737 * predict.c (combine_predictions_for_bb): Empty likely_edges and unlikely_edges if there's an edge that belongs to both these sets. 2019-03-19 Martin Liska <mliska@suse.cz> PR middle-end/89737 * gcc.dg/pr89737.c: New test. From-SVN: r269804
This commit is contained in:
parent
e8926ce09f
commit
2214085aff
@ -1,3 +1,9 @@
|
||||
2019-03-19 Martin Liska <mliska@suse.cz>
|
||||
|
||||
PR middle-end/89737
|
||||
* predict.c (combine_predictions_for_bb): Empty likely_edges and
|
||||
unlikely_edges if there's an edge that belongs to both these sets.
|
||||
|
||||
2018-03-19 Segher Boessenkool <segher@kernel.crashing.org>
|
||||
|
||||
PR target/89746
|
||||
|
@ -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);
|
||||
|
@ -1,3 +1,8 @@
|
||||
2019-03-19 Martin Liska <mliska@suse.cz>
|
||||
|
||||
PR middle-end/89737
|
||||
* gcc.dg/pr89737.c: New test.
|
||||
|
||||
2019-03-19 Jan Hubicka <hubicka@ucw.cz>
|
||||
|
||||
PR lto/87809
|
||||
|
17
gcc/testsuite/gcc.dg/pr89737.c
Normal file
17
gcc/testsuite/gcc.dg/pr89737.c
Normal file
@ -0,0 +1,17 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fdump-tree-profile_estimate" } */
|
||||
|
||||
int a, b;
|
||||
|
||||
void c() {
|
||||
&&d;
|
||||
void *e = &&f, *g = &&h;
|
||||
f:
|
||||
__attribute__((hot)) h : __attribute__((cold)) for (; a;) goto *g;
|
||||
d:
|
||||
for (; b;)
|
||||
goto *e;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-times "predicted to even probabilities" 4 "profile_estimate"} } */
|
||||
|
Loading…
Reference in New Issue
Block a user