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]

[vta, trunk] avoid -g/-g0 codegen differences out of discarding decls

I found another effect of discarding DECLs from BLOCKs too early.  If
a variable is discarded from the list of DECLs in a binding block, its
rtl won't undergo instantiation of virtual regs, which will in turn
lead to different decisions in validate_equiv_mem()'s calls to
MEM-overlap tests in true_dependence().  This led to a codegen change
in ada/sem_ch4 on x86_64 with -O1 rather than -O2, detected by

This patch fixes it.  I'm installing it in the branch.  Ok for trunk?
Should the test be more aggressive, looking for virtual regs in the
value expr, rather than just testing for the presence of a value expr?

for  gcc/ChangeLog.vta
from  Alexandre Oliva  <>

	* tree-ssa-live.c (remove_unused_scope_block_p): Keep variables
	that have value exprs.

Index: gcc/tree-ssa-live.c
--- gcc/tree-ssa-live.c.orig	2008-10-10 09:31:06.000000000 -0300
+++ gcc/tree-ssa-live.c	2008-11-14 05:50:13.000000000 -0200
@@ -489,6 +489,16 @@ remove_unused_scope_block_p (tree scope)
       if (TREE_CODE (*t) == FUNCTION_DECL)
 	unused = false;
+      /* If a decl has a value expr, we need to instantiate it
+	 regardless of debug info generation, to avoid codegen
+	 differences in memory overlap tests.  update_equiv_regs() may
+	 indirectly call validate_equiv_mem() to test whether a
+	 SET_DEST overlaps with others, and if the value expr changes
+	 by virtual register instantiation, we may get end up with
+	 different results.  */
+      else if (TREE_CODE (*t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (*t))
+	unused = false;
       /* Remove everything we don't generate debug info for.  */
       else if (DECL_IGNORED_P (*t))
Alexandre Oliva
Free Software Evangelist  oliva@{,}
FSFLA Board Member       ÂSÃ Libre! =>
Red Hat Compiler Engineer   aoliva@{,}

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