From 15db5571d1567a4d05812f85853b9b95766b8f2e Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sun, 19 Sep 2004 18:04:03 +0200 Subject: basic-block.h (update_bb_profile_after_threading): Declare. * basic-block.h (update_bb_profile_after_threading): Declare. * cfg.c (update_bb_profile_after_threading): Break out from ... * cfgcleanup.c (try_forward_edges): ... here; use it. * tree-ssa-dom.c (thread_across_edge): Use it. * tree-ssa-threadupdate.c (create_block_for_threading): Zero out profile of the new BB. From-SVN: r87730 --- gcc/cfgcleanup.c | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) (limited to 'gcc/cfgcleanup.c') diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 08714f6..f9d0607 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -614,41 +614,23 @@ try_forward_edges (int mode, basic_block b) { edge t; - first->count -= edge_count; - if (first->count < 0) - first->count = 0; - first->frequency -= edge_frequency; - if (first->frequency < 0) - first->frequency = 0; if (first->succ->succ_next) { - edge e; - int prob; - gcc_assert (n < nthreaded_edges); t = threaded_edges [n++]; gcc_assert (t->src == first); - if (first->frequency) - prob = edge_frequency * REG_BR_PROB_BASE / first->frequency; - else - prob = 0; - if (prob > t->probability) - prob = t->probability; - t->probability -= prob; - prob = REG_BR_PROB_BASE - prob; - if (prob <= 0) - { - first->succ->probability = REG_BR_PROB_BASE; - first->succ->succ_next->probability = 0; - } - else - for (e = first->succ; e; e = e->succ_next) - e->probability = ((e->probability * REG_BR_PROB_BASE) - / (double) prob); + update_bb_profile_for_threading (first, edge_frequency, + edge_count, t); update_br_prob_note (first); } else { + first->count -= edge_count; + if (first->count < 0) + first->count = 0; + first->frequency -= edge_frequency; + if (first->frequency < 0) + first->frequency = 0; /* It is possible that as the result of threading we've removed edge as it is threaded to the fallthru edge. Avoid -- cgit v1.1