From 2260bbe16dcf862ea9d372108e58055b035315ce Mon Sep 17 00:00:00 2001 From: law Date: Sun, 21 Nov 2004 20:41:37 +0000 Subject: [PATCH] * cfg.c (update_bb_profile_for_threading): Do not rescale the successor probabilities if they are not going to change. Pull division out of loop if we do need to rescale successor probabilities. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@90987 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/cfg.c | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b4f0c52320f..5c8f32e703b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2004-11-21 Jeff Law + * cfg.c (update_bb_profile_for_threading): Do not rescale the + successor probabilities if they are not going to change. Pull + division out of loop if we do need to rescale successor probabilities. + * tree-ssa-threadupdate.c (redirection_data_hash): Use the index of the destination block for the hash value rather than hashing a pointer. diff --git a/gcc/cfg.c b/gcc/cfg.c index 67b0598341f..b008bad3343 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -941,9 +941,13 @@ update_bb_profile_for_threading (basic_block bb, int edge_frequency, for (; (c = ei_safe_edge (ei)); ei_next (&ei)) c->probability = 0; } - else - FOR_EACH_EDGE (c, ei, bb->succs) - c->probability = ((c->probability * REG_BR_PROB_BASE) / (double) prob); + else if (prob != REG_BR_PROB_BASE) + { + int scale = REG_BR_PROB_BASE / prob; + + FOR_EACH_EDGE (c, ei, bb->succs) + c->probability *= scale; + } if (bb != taken_edge->src) abort (); -- 2.11.4.GIT