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]

Fix PR20204


Many thanks to H-P for finding this one and putting up with my
early denial.  This bug has been lurking ever since I added the
REWRITE_THIS_STMT shortcuts to tree-into-ssa.c.  I'm not sure how
it managed to survive this long.

When we are rewriting def-def chains, the REWRITE_THIS_STMT flag
is not set for PHI nodes (it is only set when a PHI node is
initially created).  Since using the flag would mean a pre-scan
of PHI nodes in rewrite_def_def_chains, and the time savings on
PHI nodes is not really significant, we might as well not do it.

Bootstrap and test in progress.  Mark, what's the status of the
4.0 branch?  This fix should go there too.


Diego.


	PR tree-optimization/20204
	* tree-into-ssa.c (insert_phi_nodes_for): Do not use
	REWRITE_THIS_STMT markers on PHI nodes.
	(rewrite_initialize_block): Likewise.

testsuite/ChangeLog

	PR tree-optimization/20204
	* gcc.dg/pr20204.c: New test.
	
Index: tree-into-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-into-ssa.c,v
retrieving revision 2.41
diff -d -u -p -r2.41 tree-into-ssa.c
--- tree-into-ssa.c	24 Feb 2005 14:18:46 -0000	2.41
+++ tree-into-ssa.c	25 Feb 2005 18:45:59 -0000
@@ -591,9 +591,6 @@ insert_phi_nodes_for (tree var, bitmap p
 	  FOR_EACH_EDGE (e, ei, bb->preds)
 	    add_phi_arg (phi, var, e);
 	}
-
-      /* Mark this PHI node as interesting for the rename process.  */
-      REWRITE_THIS_STMT (phi) = 1;
     }
 }
 
@@ -745,8 +742,7 @@ rewrite_initialize_block (struct dom_wal
   for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
     {
       tree result = PHI_RESULT (phi);
-      if (REWRITE_THIS_STMT (phi))
-	register_new_def (result, &block_defs_stack);
+      register_new_def (result, &block_defs_stack);
     }
 }
 
Index: testsuite/gcc.dg/pr20204.c
===================================================================
RCS file: testsuite/gcc.dg/pr20204.c
diff -N testsuite/gcc.dg/pr20204.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gcc.dg/pr20204.c	25 Feb 2005 18:46:02 -0000
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+void *x (void *pdst, const void *psrc, unsigned int pn)
+{
+  register void *return_dst __asm__ ("r10") = pdst;
+  register unsigned char *dst __asm__ ("r13") = pdst;
+  register unsigned const char *src __asm__ ("r11") = psrc;
+  register int n __asm__ ("r12") = pn;
+
+  if (src < dst && dst < src + n)
+    {
+      src += n;
+      dst += n;
+      while (n--)
+        *--dst = *--src;
+      return return_dst;
+    }
+
+  while (n >= 16) n--;
+
+  return return_dst;
+}
+extern void abort ();
+extern void exit (int);
+char xx[30] = "abc";
+int main (void)
+{
+  char yy[30] = "aab";
+
+  if (x (xx + 1, xx, 2) != xx + 1 || memcmp (xx, yy, sizeof (yy)) != 0)
+    abort ();
+  exit (0);
+}


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