From 8c09e55ed3b53099afaff01c5d1f336ddb32cc80 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Wed, 7 Nov 2007 22:05:37 +0000 Subject: 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 --- gcc/cfgcleanup.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gcc/cfgcleanup.c') 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. */ -- cgit v1.2.1