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]

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


On Nov 17, 2008, Alexandre Oliva <aoliva@redhat.com> wrote:

> 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
> -fcompare-debug.

> This patch fixes it.  I'm installing it in the branch.  Ok for trunk?

Ping?

> 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
from  Alexandre Oliva  <aoliva@redhat.com>

	* 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	2009-05-28 03:49:20.000000000 -0300
+++ gcc/tree-ssa-live.c	2009-05-28 04:04:18.000000000 -0300
@@ -435,6 +435,17 @@ remove_unused_scope_block_p (tree scope)
 	 will be output to file.  */
       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, 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]