Patchwork [PR,debug/46338] avoid spurious BB splits for profiling

login
register
mail settings
Submitter Alexandre Oliva
Date Nov. 26, 2010, 3:50 a.m.
Message ID <orlj4glp48.fsf@livre.localdomain>
Download mbox | patch
Permalink /patch/73154/
State New
Headers show

Comments

Alexandre Oliva - Nov. 26, 2010, 3:50 a.m.
We don't want to use the locus information from a debug stmt to decide
whether or not to split a BB, because this may lead to different
decisions for -g and -g0 compilations.

Regstrapped on x86_64-linux-gnu and i686-pc-linux-gnu.  Ok?
Richard Henderson - Nov. 26, 2010, 8:15 p.m.
On 11/25/2010 07:50 PM, Alexandre Oliva wrote:
> 	PR debug/46338
> 	* profile.c (branch_prob): Skip debug stmts for BB end locus.

Ok.


r~

Patch

for gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	PR debug/46338
	* profile.c (branch_prob): Skip debug stmts for BB end locus.

Index: gcc/profile.c
===================================================================
--- gcc/profile.c.orig	2010-11-22 20:05:55.558067049 -0200
+++ gcc/profile.c	2010-11-23 23:31:07.309901035 -0200
@@ -937,10 +937,11 @@  branch_prob (void)
 	  /* It may happen that there are compiler generated statements
 	     without a locus at all.  Go through the basic block from the
 	     last to the first statement looking for a locus.  */
-	  for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi))
+	  for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi);
+	       gsi_prev (&gsi))
 	    {
 	      last = gsi_stmt (gsi);
-	      if (gimple_has_location (last))
+	      if (!is_gimple_debug (last) && gimple_has_location (last))
 		break;
 	    }