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 profiledbootstrap and rest of bprob failures


Hi,
this patch should fix remaining problems with profile. These all come
from the scenario where old loop optimizer is present and we do RTL
profiling with tree branch guessing that is something I obviously didn't 
tested well as tree-profiling branch does tree based profiling by
default.  My apologizes for this ommision.
(I missed the failures on testing before commit because I tested the
patch before I unbroke the testcases originally)

Bootstrapped/regtested i686-pc-gnu-linux, profiledbootstrapped
i386-linux, commited.

2004-09-26  Jan Hubicka  <jh@suse.cz>

	* profile.c (compute_branch_probabilities): Use REG_BR_PROB notes
	when re-constructing profile previously invalidated by loop.

Index: profile.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/profile.c,v
retrieving revision 1.145
diff -c -3 -p -r1.145 profile.c
*** profile.c	25 Sep 2004 10:06:16 -0000	1.145
--- profile.c	25 Sep 2004 11:08:25 -0000
*************** compute_branch_probabilities (void)
*** 557,568 ****
  	      num_branches++;
  	    }
  	}
!       /* Otherwise distribute the probabilities evenly so we get sane
! 	 sum.  Use simple heuristics that if there are normal edges,
  	 give all abnormals frequency of 0, otherwise distribute the
  	 frequency over abnormals (this is the case of noreturn
  	 calls).  */
!       else
  	{
  	  int total = 0;
  
--- 557,580 ----
  	      num_branches++;
  	    }
  	}
!       /* Otherwise try to preserve the existing REG_BR_PROB probabilities
!          tree based profile guessing put into code.  */
!       else if (profile_status == PROFILE_ABSENT
! 	       && !ir_type ()
! 	       && bb->succ && bb->succ->succ_next
! 	       && (note = find_reg_note (BB_END (bb), REG_BR_PROB, 0)))
! 	{
! 	  int prob = INTVAL (XEXP (note, 0));
! 
! 	  BRANCH_EDGE (bb)->probability = prob;
! 	  FALLTHRU_EDGE (bb)->probability = REG_BR_PROB_BASE - prob;
! 	}
!       /* As a last resolt, distribute the probabilities evenly.
! 	 Use simple heuristics that if there are normal edges,
  	 give all abnormals frequency of 0, otherwise distribute the
  	 frequency over abnormals (this is the case of noreturn
  	 calls).  */
!       else if (profile_status == PROFILE_ABSENT)
  	{
  	  int total = 0;
  


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