From afc970a415a9c8e06ebcec7c3fde19a7983b259c Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sat, 25 Jun 2005 13:59:55 +0200 Subject: [PATCH] tree-ssa-phiopt.c (replace_phi_edge_with_variable): Update profile. * 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 | 3 +++ gcc/cfg.c | 2 +- gcc/tree-ssa-phiopt.c | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 87e59aa73a4..d0224662449 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 2005-06-25 Jan Hubicka + * 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. diff --git a/gcc/cfg.c b/gcc/cfg.c index 4a3e6ad5cd9..044fcaef242 100644 --- 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); diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index f72cb1ba707..e7d048f5387 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -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; } -- 2.30.2