This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix profile updating in dom/redphi


Hi,
this fixes the problems wrt updating profile (i.e. Jeff speedup to
update_bb_profile_for_threading didn't get the rescaling quite right and
tree-ssa-phiopt.c while removing conditional needs to set properly the
frequency and probability of edge)

Bootstrapped/regtested i686-pc-gnu-linux, comitted.
Honza

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.9224
diff -c -3 -p -r2.9224 ChangeLog
*** ChangeLog	25 Jun 2005 11:57:33 -0000	2.9224
--- ChangeLog	25 Jun 2005 11:58:58 -0000
***************
*** 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: cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfg.c,v
retrieving revision 1.96
diff -c -3 -p -r1.96 cfg.c
*** cfg.c	25 Jun 2005 01:59:26 -0000	1.96
--- cfg.c	25 Jun 2005 11:58:58 -0000
*************** update_bb_profile_for_threading (basic_b
*** 901,907 ****
        int scale = 65536 * REG_BR_PROB_BASE / prob;
  
        FOR_EACH_EDGE (c, ei, bb->succs)
! 	c->probability *= scale / 65536;
      }
  
    gcc_assert (bb == taken_edge->src);
--- 901,907 ----
        int scale = 65536 * REG_BR_PROB_BASE / prob;
  
        FOR_EACH_EDGE (c, ei, bb->succs)
! 	c->probability = (c->probability * scale) / 65536;
      }
  
    gcc_assert (bb == taken_edge->src);
Index: tree-ssa-phiopt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-phiopt.c,v
retrieving revision 2.39
diff -c -3 -p -r2.39 tree-ssa-phiopt.c
*** tree-ssa-phiopt.c	25 Jun 2005 02:01:44 -0000	2.39
--- tree-ssa-phiopt.c	25 Jun 2005 11:58:58 -0000
*************** replace_phi_edge_with_variable (basic_bl
*** 331,336 ****
--- 331,338 ----
      {
        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;
      }
*************** replace_phi_edge_with_variable (basic_bl
*** 339,344 ****
--- 341,348 ----
        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;
      }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]