aboutsummaryrefslogtreecommitdiff
path: root/gcc/shrink-wrap.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2017-11-14 10:22:49 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2017-11-14 09:22:49 +0000
commitfee234f10fa45066a0a50a3312a642fe8c6c17b5 (patch)
tree38717716367363bc9c6333ad40a0bc238b90eeec /gcc/shrink-wrap.c
parentfc06ae0d196a321425aefe9e2e262abfb10c0775 (diff)
downloadgcc-fee234f10fa45066a0a50a3312a642fe8c6c17b5.zip
gcc-fee234f10fa45066a0a50a3312a642fe8c6c17b5.tar.gz
gcc-fee234f10fa45066a0a50a3312a642fe8c6c17b5.tar.bz2
tracer.c (better_p): Do not compare frequencies.
* tracer.c (better_p): Do not compare frequencies. * reg-stack.c (better_edge): Likewise. * shrink-wrap.c (try_shrink_wrapping): Do not convert to gcov counts and back. From-SVN: r254726
Diffstat (limited to 'gcc/shrink-wrap.c')
-rw-r--r--gcc/shrink-wrap.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/shrink-wrap.c b/gcc/shrink-wrap.c
index 0e4ff6c..ce2ddfc 100644
--- a/gcc/shrink-wrap.c
+++ b/gcc/shrink-wrap.c
@@ -880,19 +880,18 @@ try_shrink_wrapping (edge *entry_edge, rtx_insn *prologue_seq)
the correct answer for reducible flow graphs; for irreducible flow graphs
our profile is messed up beyond repair anyway. */
- gcov_type num = 0;
- gcov_type den = 0;
+ profile_count num = profile_count::zero ();
+ profile_count den = profile_count::zero ();
FOR_EACH_EDGE (e, ei, pro->preds)
if (!dominated_by_p (CDI_DOMINATORS, e->src, pro))
{
- num += EDGE_FREQUENCY (e);
- den += e->src->count.to_frequency (cfun);
+ if (e->count ().initialized_p ())
+ num += e->count ();
+ if (e->src->count.initialized_p ())
+ den += e->src->count;
}
- if (den == 0)
- den = 1;
-
/* All is okay, so do it. */
crtl->shrink_wrapped = true;
@@ -919,8 +918,9 @@ try_shrink_wrapping (edge *entry_edge, rtx_insn *prologue_seq)
if (dump_file)
fprintf (dump_file, "Duplicated %d to %d\n", bb->index, dup->index);
-
- bb->count = bb->count.apply_scale (num, den);
+
+ if (num == profile_count::zero () || den.nonzero_p ())
+ bb->count = bb->count.apply_scale (num, den);
dup->count -= bb->count;
}