diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-11-07 22:05:37 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-11-07 22:05:37 +0000 |
commit | 8c09e55ed3b53099afaff01c5d1f336ddb32cc80 (patch) | |
tree | 3b09819b82398b3577c387dc732255b7f014c8d4 /gcc/cfgcleanup.c | |
parent | eeb0ae2330c278624a09d903512153cef5cab34d (diff) | |
download | gcc-8c09e55ed3b53099afaff01c5d1f336ddb32cc80.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129973 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgcleanup.c')
-rw-r--r-- | gcc/cfgcleanup.c | 10 |
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. */ |