summaryrefslogtreecommitdiff
path: root/gcc/cfgcleanup.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@libertysurf.fr>2007-11-07 23:05:37 +0100
committerEric Botcazou <ebotcazou@gcc.gnu.org>2007-11-07 22:05:37 +0000
commit52982a970e03e299950638b623243d7724aa8962 (patch)
tree3b09819b82398b3577c387dc732255b7f014c8d4 /gcc/cfgcleanup.c
parent8c6c36a3c9583d2e804edd181c75e076a4f38b3e (diff)
downloadgcc-52982a970e03e299950638b623243d7724aa8962.tar.gz
re PR rtl-optimization/33737 (verify_flow_info failed: Wrong probability of edge 94->1 -6651)
PR rtl-optimization/33737 * cfgcleanup.c (try_crossjump_to_edge): Add count and frequency of target block after computing the probabilities of outgoing edges. Cap the frequency to BB_FREQ_MAX. * tree-ssa-threadupdate.c (redirect_edges): Also adjust count and frequency of the basic block if it has been reused. From-SVN: r129973
Diffstat (limited to 'gcc/cfgcleanup.c')
-rw-r--r--gcc/cfgcleanup.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 7b2ec0dd76c..b1c94da8489 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -1699,8 +1699,6 @@ try_crossjump_to_edge (int mode, edge e1, edge e2)
"Cross jumping from bb %i to bb %i; %i common insns\n",
src1->index, src2->index, nmatch);
- redirect_to->count += src1->count;
- redirect_to->frequency += src1->frequency;
/* We may have some registers visible through the block. */
df_set_bb_dirty (redirect_to);
@@ -1757,6 +1755,14 @@ try_crossjump_to_edge (int mode, edge e1, edge e2)
/ (redirect_to->frequency + src1->frequency));
}
+ /* Adjust count and frequency for the block. An earlier jump
+ threading pass may have left the profile in an inconsistent
+ state (see update_bb_profile_for_threading) so we must be
+ prepared for overflows. */
+ redirect_to->count += src1->count;
+ redirect_to->frequency += src1->frequency;
+ if (redirect_to->frequency > BB_FREQ_MAX)
+ redirect_to->frequency = BB_FREQ_MAX;
update_br_prob_note (redirect_to);
/* Edit SRC1 to go to REDIRECT_TO at NEWPOS1. */