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 latent compare-debug problem in cprop


If cprop regards changes to debug insns as âchangedâ, it will perform
cfg optimizations and more, even if no non-debug insns were changed,
causing divergence between -g and -g0 compilations.

This was observed during bootstrap-debug-lib of the SSA coalesce patch,
building a-strsea.adb with -fcompare-debug.  Because of different CFGs,
cse2 chose different equivalent pseudos for an insn.  -fcompare-debug
detected the difference in REG notes, even though the executable code
turned out to be the same.  We can't count on this luck, though: other
optimization passes could apply different transformations to the
different CFGs, producing different executable code, which must never
happen.

This patch fixes the problem, disregarding changes to debug insns as
âchangedâ.  Regstrapped on x86_64-linux-gnu and i686-linux-gnu.  Ok to
install?

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

	* cprop.c (local_cprop_pass): Don't set changed for debug insns.

Index: gcc/cprop.c
===================================================================
--- gcc/cprop.c.orig	2011-06-04 05:09:24.414816329 -0300
+++ gcc/cprop.c	2011-06-04 05:09:25.954797626 -0300
@@ -1223,7 +1223,8 @@ local_cprop_pass (void)
 		    {
 		      if (do_local_cprop (reg_use_table[i], insn))
 			{
-			  changed = true;
+			  if (!DEBUG_INSN_P (insn))
+			    changed = true;
 			  break;
 			}
 		    }

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   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]