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: [patch,rfc] PR25196


On Wednesday 21 December 2005 00:07, Ian Lance Taylor wrote:
> Anyhow, let's not worry too much about PUSH_ROUNDING, which is just
> gilding the lily.  I'll approve your patch if you use GET_RTX_CLASS,
> and if it passes bootstrap and testing.  Please also add the test
> case.

Here is what I am testing.

Index: postreload-gcse.c
===================================================================
--- postreload-gcse.c	(revision 108853)
+++ postreload-gcse.c	(working copy)
@@ -672,10 +672,22 @@ record_last_set_info (rtx dest, rtx sett
 
   if (REG_P (dest))
     record_last_reg_set_info (last_set_insn, REGNO (dest));
-  else if (MEM_P (dest)
-	   /* Ignore pushes, they clobber nothing.  */
-	   && ! push_operand (dest, GET_MODE (dest)))
-    record_last_mem_set_info (last_set_insn);
+  else if (MEM_P (dest))
+    {
+      /* Ignore pushes, they don't clobber memory.  They may still
+	 clobber the stack pointer though.  Some targets do argument
+	 pushes without adding REG_INC notes.  See e.g. PR25196,
+	 where a pushsi2 on i386 doesn't have REG_INC notes.  Note
+	 such changes here too.  */
+      if (! push_operand (dest, GET_MODE (dest)))
+	record_last_mem_set_info (last_set_insn);
+      else
+	{
+	  rtx addr = XEXP (dest, 0);
+	  if (GET_RTX_CLASS (GET_CODE (addr)) == RTX_AUTOINC)
+	    record_last_reg_set_info (last_set_insn, REGNO (XEXP (addr, 0)));
+	}
+    }
 }
 
 
Index: testsuite/gcc.dg/pr25130.c
===================================================================
--- testsuite/gcc.dg/pr25130.c	(revision 0)
+++ testsuite/gcc.dg/pr25130.c	(revision 0)
@@ -0,0 +1,34 @@
+/* { dg-do run { target i?86-*-* x86_64-*-* } } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-march=i386 -O3 -fomit-frame-pointer" } */
+
+/* For this test case, we used to do an invalid load motion after
+   reload, because we missed autoincrements of the stack pointer.  */
+
+extern void abort (void);
+
+static int j;
+
+static void __attribute__((noinline))
+f1 (int a, int b, int c, int d, int e)
+{
+  j = a;
+}
+
+int __attribute__((noinline))
+f2 (int a, int b, int c, int d, int e)
+{
+  if ((b & 0x1111) != 1)
+    f1 (a, b, c, d, e);
+  return 0;
+}
+
+int
+main (void)
+{
+  f2 (123, 0, 0, 0, 0);
+  if (j != 123)
+    abort ();
+  return 0;
+}
+


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