tree-ssa-phiopt.c (replace_phi_edge_with_variable): Update profile.
authorJan Hubicka <jh@suse.cz>
Sat, 25 Jun 2005 11:59:55 +0000 (13:59 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sat, 25 Jun 2005 11:59:55 +0000 (11:59 +0000)
* tree-ssa-phiopt.c (replace_phi_edge_with_variable): Update profile.
* cfg.c (update_bb_profile_for_threading): Fix rescaling.

From-SVN: r101322

gcc/ChangeLog
gcc/cfg.c
gcc/tree-ssa-phiopt.c

index 87e59aa73a40fe44b06e6e7eb3980ce4abfc89ee..d02246624490dde3ec5cf4e09b1f839eac41f513 100644 (file)
@@ -1,5 +1,8 @@
 2005-06-25  Jan Hubicka  <jh@suse.cz>
 
+       * tree-ssa-phiopt.c (replace_phi_edge_with_variable): Update profile.
+       * cfg.c (update_bb_profile_for_threading): Fix rescaling.
+
        * passes.c (rest_of_handle_branch_prob): Do not rebuild profiling info
        when not neecesary
        (rest_of_compilation): Fix conditional on branch prob pass.
index 4a3e6ad5cd927e97d945ce762776881cc6dabc1e..044fcaef2427f78d1345d32acb72a7651fc1d6dd 100644 (file)
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -901,7 +901,7 @@ update_bb_profile_for_threading (basic_block bb, int edge_frequency,
       int scale = 65536 * REG_BR_PROB_BASE / prob;
 
       FOR_EACH_EDGE (c, ei, bb->succs)
-       c->probability *= scale / 65536;
+       c->probability = (c->probability * scale) / 65536;
     }
 
   gcc_assert (bb == taken_edge->src);
index f72cb1ba7073646dfe5b05599c4047a86d818603..e7d048f5387ca7820ecbaa8171faec7e111da575 100644 (file)
@@ -331,6 +331,8 @@ replace_phi_edge_with_variable (basic_block cond_block,
     {
       EDGE_SUCC (cond_block, 0)->flags |= EDGE_FALLTHRU;
       EDGE_SUCC (cond_block, 0)->flags &= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE);
+      EDGE_SUCC (cond_block, 0)->probability = REG_BR_PROB_BASE;
+      EDGE_SUCC (cond_block, 0)->count += EDGE_SUCC (cond_block, 1)->count;
 
       block_to_remove = EDGE_SUCC (cond_block, 1)->dest;
     }
@@ -339,6 +341,8 @@ replace_phi_edge_with_variable (basic_block cond_block,
       EDGE_SUCC (cond_block, 1)->flags |= EDGE_FALLTHRU;
       EDGE_SUCC (cond_block, 1)->flags
        &= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE);
+      EDGE_SUCC (cond_block, 1)->probability = REG_BR_PROB_BASE;
+      EDGE_SUCC (cond_block, 1)->count += EDGE_SUCC (cond_block, 0)->count;
 
       block_to_remove = EDGE_SUCC (cond_block, 0)->dest;
     }