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]

[PR debug/47079] fix fallout from PR 46724


The patch to better track variables merged with RESULT_DECLs because of
NVR ended up regressing guality/nrv-1.c on x86 32-bit, because the RTL
hadn't undergone register elimination, and still referenced
virtual_incoming_args_rtx.  This was not an issue on x86_64, because of
different calling conventions.

This patch makes sure var-tracking isn't handed RTL with
virtual_incoming_args_rtx, and arranges for us to perform virtual
register elimination on incoming rtl and on other decls referenced in
DECL_VALUE_EXPR, which is enough for nrv-1 to pass again.

Regstrapped on x86_64-linux-gnu and i686-linux-gnu.  Ok?

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

	PR debug/47079
	PR debug/46724
	* function.c (instantiate_expr): Instantiate incoming rtl of
	implicit arguments, and recurse on VALUE_EXPRs.
	(instantiate_decls): Instantiate rtl and VALUE_EXPR of result.
	* var-tracking.c (adjust_mems): Reject virtual_incoming_args_rtx.

Index: gcc/function.c
===================================================================
--- gcc/function.c.orig	2010-12-28 20:24:03.881770200 -0200
+++ gcc/function.c	2010-12-28 21:37:47.492920482 -0200
@@ -1784,8 +1784,21 @@ instantiate_expr (tree *tp, int *walk_su
   if (! EXPR_P (t))
     {
       *walk_subtrees = 0;
-      if (DECL_P (t) && DECL_RTL_SET_P (t))
-	instantiate_decl_rtl (DECL_RTL (t));
+      if (DECL_P (t))
+	{
+	  if (DECL_RTL_SET_P (t))
+	    instantiate_decl_rtl (DECL_RTL (t));
+	  if (TREE_CODE (t) == PARM_DECL && DECL_NAMELESS (t)
+	      && DECL_INCOMING_RTL (t))
+	    instantiate_decl_rtl (DECL_INCOMING_RTL (t));
+	  if ((TREE_CODE (t) == VAR_DECL
+	       || TREE_CODE (t) == RESULT_DECL)
+	      && DECL_HAS_VALUE_EXPR_P (t))
+	    {
+	      tree v = DECL_VALUE_EXPR (t);
+	      walk_tree (&v, instantiate_expr, NULL, NULL);
+	    }
+	}
     }
   return NULL;
 }
@@ -1835,6 +1848,18 @@ instantiate_decls (tree fndecl)
 	}
     }
 
+  if ((decl = DECL_RESULT (fndecl))
+      && TREE_CODE (decl) == RESULT_DECL)
+    {
+      if (DECL_RTL_SET_P (decl))
+	instantiate_decl_rtl (DECL_RTL (decl));
+      if (DECL_HAS_VALUE_EXPR_P (decl))
+	{
+	  tree v = DECL_VALUE_EXPR (decl);
+	  walk_tree (&v, instantiate_expr, NULL, NULL);
+	}
+    }
+
   /* Now process all variables defined in the function or its subblocks.  */
   instantiate_decls_1 (DECL_INITIAL (fndecl));
 
Index: gcc/var-tracking.c
===================================================================
--- gcc/var-tracking.c.orig	2010-12-28 19:14:24.501730254 -0200
+++ gcc/var-tracking.c	2010-12-28 20:43:03.825871640 -0200
@@ -805,6 +805,7 @@ adjust_mems (rtx loc, const_rtx old_rtx,
 	       && hard_frame_pointer_adjustment != -1
 	       && cfa_base_rtx)
 	return compute_cfa_pointer (hard_frame_pointer_adjustment);
+      gcc_checking_assert (loc != virtual_incoming_args_rtx);
       return loc;
     case MEM:
       mem = loc;
-- 
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]