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]

Avoid rebuilding of profile when not runnning old loop


Hi,
this avoids rebuilding of profile when profile survives till late RTL
stage.  Also enables the __builtin_expect killing pass once profile is
built.

bootstrapped/regtested i686-pc-gnu-linux, commited.

Honza

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.9222
diff -c -3 -p -r2.9222 ChangeLog
*** ChangeLog	25 Jun 2005 01:58:38 -0000	2.9222
--- ChangeLog	25 Jun 2005 11:55:15 -0000
***************
*** 1,3 ****
--- 1,11 ----
+ 2005-06-25  Jan Hubicka  <jh@suse.cz>
+ 
+ 	* passes.c (rest_of_handle_branch_prob): Do not rebuild profiling info
+ 	when not neecesary
+ 	(rest_of_compilation): Fix conditional on branch prob pass.
+ 	* predict.c (tree_estimate_probability): Enable strip_builtin_expect
+ 	when not loop optimizing.
+ 
  2005-06-25  Kelley Cook  <kcook@gcc.gnu.org>
  
  	* all files: Update FSF address in copyright headers.
Index: passes.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/passes.c,v
retrieving revision 2.93
diff -c -3 -p -r2.93 passes.c
*** passes.c	25 Jun 2005 02:00:43 -0000	2.93
--- passes.c	25 Jun 2005 11:55:15 -0000
*************** rest_of_handle_branch_prob (void)
*** 790,796 ****
    timevar_push (TV_BRANCH_PROB);
    open_dump_file (DFI_bp, current_function_decl);
  
!   if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
      branch_prob ();
  
    /* Discover and record the loop depth at the head of each basic
--- 790,797 ----
    timevar_push (TV_BRANCH_PROB);
    open_dump_file (DFI_bp, current_function_decl);
  
!   if ((profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
!       && !flag_tree_based_profiling)
      branch_prob ();
  
    /* Discover and record the loop depth at the head of each basic
*************** rest_of_handle_branch_prob (void)
*** 801,807 ****
      flow_loops_dump (&loops, dump_file, NULL, 0);
  
    /* Estimate using heuristics if no profiling info is available.  */
!   if (flag_guess_branch_prob)
      estimate_probability (&loops);
  
    flow_loops_free (&loops);
--- 802,808 ----
      flow_loops_dump (&loops, dump_file, NULL, 0);
  
    /* Estimate using heuristics if no profiling info is available.  */
!   if (flag_guess_branch_prob && profile_status == PROFILE_ABSENT)
      estimate_probability (&loops);
  
    flow_loops_free (&loops);
*************** rest_of_compilation (void)
*** 1579,1587 ****
    timevar_push (TV_FLOW);
    rest_of_handle_cfg ();
  
!   if (!flag_tree_based_profiling
!       && (optimize > 0 || profile_arc_flag
! 	  || flag_test_coverage || flag_branch_probabilities))
      {
        rtl_register_profile_hooks ();
        rtl_register_value_prof_hooks ();
--- 1580,1588 ----
    timevar_push (TV_FLOW);
    rest_of_handle_cfg ();
  
!   if (optimize > 0
!       || ((profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
! 	  && !flag_tree_based_profiling))
      {
        rtl_register_profile_hooks ();
        rtl_register_value_prof_hooks ();
*************** rest_of_compilation (void)
*** 1589,1594 ****
--- 1590,1596 ----
  
        if (flag_branch_probabilities
  	  && flag_profile_values
+           && !flag_tree_based_profiling
  	  && (flag_value_profile_transformations
  	      || flag_speculative_prefetching))
  	rest_of_handle_value_profile_transformations ();
Index: predict.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/predict.c,v
retrieving revision 1.150
diff -c -3 -p -r1.150 predict.c
*** predict.c	25 Jun 2005 02:00:44 -0000	1.150
--- predict.c	25 Jun 2005 11:55:15 -0000
*************** tree_estimate_probability (void)
*** 1383,1389 ****
    FOR_EACH_BB (bb)
      combine_predictions_for_bb (dump_file, bb);
  
!   if (0)  /* FIXME: Enable once we are pass down the profile to RTL level.  */
      strip_builtin_expect ();
    estimate_bb_frequencies (&loops_info);
    free_dominance_info (CDI_POST_DOMINATORS);
--- 1383,1389 ----
    FOR_EACH_BB (bb)
      combine_predictions_for_bb (dump_file, bb);
  
!   if (!flag_loop_optimize)
      strip_builtin_expect ();
    estimate_bb_frequencies (&loops_info);
    free_dominance_info (CDI_POST_DOMINATORS);


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