From b0a12b5e4612ba1c4013e0f2549b82f0690c9458 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 6 Jul 2017 18:12:01 +0200 Subject: [PATCH] bb-reorder.c (better_edge_p): Do not build traces across abnormal/eh edges... * bb-reorder.c (better_edge_p): Do not build traces across abnormal/eh edges; zero probability is not better than uninitialized. From-SVN: r250033 --- gcc/ChangeLog | 5 +++++ gcc/bb-reorder.c | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e0fe1a63858..f2a15a186a8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-07-06 Jan Hubicka + + * bb-reorder.c (better_edge_p): Do not build traces across abnormal/eh + edges; zero probability is not better than uninitialized. + 2017-07-06 Maxim Ostapenko * asan.h (asan_sanitize_allocas_p): Declare. diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c index 1994c1f7a5f..a421f6b3c71 100644 --- a/gcc/bb-reorder.c +++ b/gcc/bb-reorder.c @@ -957,7 +957,14 @@ better_edge_p (const_basic_block bb, const_edge e, profile_probability prob, return !cur_best_edge || cur_best_edge->dest->index > e->dest->index; - if (prob > best_prob + diff_prob || !best_prob.initialized_p ()) + /* Those edges are so expensive that continuing a trace is not useful + performance wise. */ + if (e->flags & (EDGE_ABNORMAL | EDGE_EH)) + return false; + + if (prob > best_prob + diff_prob + || (!best_prob.initialized_p () + && prob > profile_probability::guessed_never ())) /* The edge has higher probability than the temporary best edge. */ is_better_edge = true; else if (prob < best_prob - diff_prob) -- 2.30.2