This is the mail archive of the 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]

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

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?

for gcc/ChangeLog
from  Alexandre Oliva  <>

	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))

Alexandre Oliva, freedom fighter
You must be the change you wish to see in the world. -- Gandhi
Be Free! --   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

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