]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cfg.c (update_bb_profile_for_threading): Do not rescale the successor probabilities...
authorJeff Law <law@redhat.com>
Sun, 21 Nov 2004 20:41:37 +0000 (13:41 -0700)
committerJeff Law <law@gcc.gnu.org>
Sun, 21 Nov 2004 20:41:37 +0000 (13:41 -0700)
        * 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.

From-SVN: r90987

gcc/ChangeLog
gcc/cfg.c

index b4f0c52320f027901051b40fcaec30f10ada6504..5c8f32e703b88e94c040dab7b6841b99831fad26 100644 (file)
@@ -1,5 +1,9 @@
 2004-11-21  Jeff Law  <law@redhat.com>
 
+       * 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.
index 67b0598341fad7736b9b76b066800e19b27f905a..b008bad3343614c8bf41e57876e09fc65ae09039 100644 (file)
--- 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 ();