aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-05-30 14:55:04 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-05-30 14:55:04 +0000
commit74e0960e3ee7274e5b564e26f81660524b13d447 (patch)
tree90cffa9917bdd682d4f2983aeb3295ac9494cc86 /gcc
parentd0b51297b0b12584251e4eebcd7d8e6fd48edc20 (diff)
downloadgcc-74e0960e3ee7274e5b564e26f81660524b13d447.zip
gcc-74e0960e3ee7274e5b564e26f81660524b13d447.tar.gz
gcc-74e0960e3ee7274e5b564e26f81660524b13d447.tar.bz2
re PR tree-optimization/85964 (compile time hog w/ -O3 -ftracer -fno-guess-branch-probability)
2018-05-30 Richard Biener <rguenther@suse.de> PR tree-optimization/85964 * tracer.c (better_p): Drop initialized count check, we only call the function with initialized counts now. (find_best_successor): Do find a best edge if one has uninitialized count. (find_best_predecessor): Likewise. Do BB frequency check only if count is initialized. From-SVN: r260954
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/tracer.c27
2 files changed, 27 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9b89baa..ff61ca5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2018-05-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/85964
+ * tracer.c (better_p): Drop initialized count check, we only
+ call the function with initialized counts now.
+ (find_best_successor): Do find a best edge if one
+ has uninitialized count.
+ (find_best_predecessor): Likewise. Do BB frequency check only
+ if count is initialized.
+
2017-05-30 Jackson Woodruff <jackson.woodruff@arm.com>
* config/aarch64/aarch64.c (aarch64_host_wide_int_compare): New.
diff --git a/gcc/tracer.c b/gcc/tracer.c
index 58f4ec1d..6181513 100644
--- a/gcc/tracer.c
+++ b/gcc/tracer.c
@@ -132,8 +132,7 @@ count_insns (basic_block bb)
static bool
better_p (const_edge e1, const_edge e2)
{
- if (e1->count ().initialized_p () && e2->count ().initialized_p ()
- && ((e1->count () > e2->count ()) || (e1->count () < e2->count ())))
+ if ((e1->count () > e2->count ()) || (e1->count () < e2->count ()))
return e1->count () > e2->count ();
/* This is needed to avoid changes in the decision after
CFG is modified. */
@@ -152,12 +151,15 @@ find_best_successor (basic_block bb)
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->succs)
- if (!best || better_p (e, best))
- best = e;
+ {
+ if (!e->count ().initialized_p ())
+ return NULL;
+ if (!best || better_p (e, best))
+ best = e;
+ }
if (!best || ignore_bb_p (best->dest))
return NULL;
- if (best->probability.initialized_p ()
- && best->probability.to_reg_br_prob_base () <= probability_cutoff)
+ if (best->probability.to_reg_br_prob_base () <= probability_cutoff)
return NULL;
return best;
}
@@ -172,12 +174,17 @@ find_best_predecessor (basic_block bb)
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->preds)
- if (!best || better_p (e, best))
- best = e;
+ {
+ if (!e->count ().initialized_p ())
+ return NULL;
+ if (!best || better_p (e, best))
+ best = e;
+ }
if (!best || ignore_bb_p (best->src))
return NULL;
- if (EDGE_FREQUENCY (best) * REG_BR_PROB_BASE
- < bb->count.to_frequency (cfun) * branch_ratio_cutoff)
+ if (bb->count.initialized_p ()
+ && (best->count ().to_frequency (cfun) * REG_BR_PROB_BASE
+ < bb->count.to_frequency (cfun) * branch_ratio_cutoff))
return NULL;
return best;
}