[PR49888,VTA] don't keep VALUEs bound to modified MEMs

Message ID oripe1p1yk.fsf@livre.localdomain
State New
Headers show

Commit Message

Alexandre Oliva July 6, 2012, 11:24 a.m.
On Jun 21, 2012, Alexandre Oliva <aoliva@redhat.com> wrote:

> Here's one more patch that addresses a problem I found out while
> investigating the PR53671 regressions: rather than recording incoming
> stack args as MEMs with non-VALUE expressions, it's more consistent (and
> less surprising) if we emit them as VALUE expressions, like other MEMs.

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

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

> 	* var-tracking.c (vt_add_function_parameter): Use a preserved
> 	VALUE for the MEM address of an incoming parameter.

This caused the bug described in PR debug/53820.

PA64 uses a pseudo for the internal arg pointer.  This pseudo isn't
recorded as a preserved VALUE, and it doesn't really make sense to
record a use of this pseudo at the entry point, before it is even set.
There's also code that prevents us from using pseudos in var-tracking.

This patch arranges for the internal arg pointer to be substituted for
the actual arg pointer.  John David Angling verified that the patch
fixes the problem on the affected platform.  I regstrapped it on x86_64-
and i686-linux-gnu.  I'm checking it in momentarily, as obvious.


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

	PR debug/53820
	* var-tracking.c (vt_add_function_parameter): Convert
	internal_arg_pointer into arg_pointer-based address even
	without DRAP.

Index: gcc/var-tracking.c
--- gcc/var-tracking.c.orig	2012-07-02 10:51:19.036061050 -0300
+++ gcc/var-tracking.c	2012-07-02 12:14:04.000000000 -0300
@@ -9327,14 +9327,11 @@  vt_add_function_parameter (tree parm)
   if (GET_MODE (decl_rtl) == BLKmode || GET_MODE (incoming) == BLKmode)
-  /* If there is a DRAP register, rewrite the incoming location of parameters
-     passed on the stack into MEMs based on the argument pointer, as the DRAP
-     register can be reused for other purposes and we do not track locations
-     based on generic registers.  But the prerequisite is that this argument
-     pointer be also the virtual CFA pointer, see vt_initialize.  */
+  /* If there is a DRAP register or a pseudo in internal_arg_pointer,
+     rewrite the incoming location of parameters passed on the stack
+     into MEMs based on the argument pointer, so that incoming doesn't
+     depend on a pseudo.  */
   if (MEM_P (incoming)
-      && stack_realign_drap
-      && arg_pointer_rtx == cfa_base_rtx
       && (XEXP (incoming, 0) == crtl->args.internal_arg_pointer
 	  || (GET_CODE (XEXP (incoming, 0)) == PLUS
 	      && XEXP (XEXP (incoming, 0), 0)