diff mbox

[rs6000] Disable static branch prediction in absence of real profile data

Message ID 56A94E4F.6010306@linux.vnet.ibm.com
State New
Headers show

Commit Message

Pat Haugen Jan. 27, 2016, 11:10 p.m. UTC
The following patch prevents static prediction if we don't have real 
profile data. Testing on SPEC CPU2006 showed a couple improvements in 
specint and specfp neutral. Bootstrap/regtest on powerpc64 with no new 
regressions. Ok for trunk?

-Pat


2016-01-27  Pat Haugen  <pthaugen@us.ibm.com>

         * config/rs6000/rs6000.c (output_cbranch): Don't statically predict
         branches if using guessed profile.

Comments

David Edelsohn Jan. 28, 2016, 3:44 a.m. UTC | #1
On Wed, Jan 27, 2016 at 6:10 PM, Pat Haugen <pthaugen@linux.vnet.ibm.com> wrote:
> The following patch prevents static prediction if we don't have real profile
> data. Testing on SPEC CPU2006 showed a couple improvements in specint and
> specfp neutral. Bootstrap/regtest on powerpc64 with no new regressions. Ok
> for trunk?
>
> -Pat
>
>
> 2016-01-27  Pat Haugen  <pthaugen@us.ibm.com>
>
>         * config/rs6000/rs6000.c (output_cbranch): Don't statically predict
>         branches if using guessed profile.

Okay.

Thanks, David
diff mbox

Patch

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 232881)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -21424,14 +21424,15 @@  output_cbranch (rtx op, const char *labe
       /* PROB is the difference from 50%.  */
       int prob = XINT (note, 0) - REG_BR_PROB_BASE / 2;
 
-      /* Only hint for highly probable/improbable branches on newer
-	 cpus as static prediction overrides processor dynamic
-	 prediction.  For older cpus we may as well always hint, but
+      /* Only hint for highly probable/improbable branches on newer cpus when
+	 we have real profile data, as static prediction overrides processor
+	 dynamic prediction.  For older cpus we may as well always hint, but
 	 assume not taken for branches that are very close to 50% as a
 	 mispredicted taken branch is more expensive than a
 	 mispredicted not-taken branch.  */
       if (rs6000_always_hint
 	  || (abs (prob) > REG_BR_PROB_BASE / 100 * 48
+	      && (profile_status_for_fn (cfun) != PROFILE_GUESSED)
 	      && br_prob_note_reliable_p (note)))
 	{
 	  if (abs (prob) > REG_BR_PROB_BASE / 20