diff mbox

RTL cprop vs. fixed hard regs

Message ID 20150117030803.GZ23768@bubble.grove.modra.org
State New
Headers show

Commit Message

Alan Modra Jan. 17, 2015, 3:08 a.m. UTC
On Sat, Jan 17, 2015 at 11:16:57AM +1030, Alan Modra wrote:
> On Fri, Jan 16, 2015 at 09:35:16AM -0700, Jeff Law wrote:
> > On 01/16/15 02:42, Alan Modra wrote:
> > >	* cprop.c (do_local_cprop): Disallow replacement of fixed
> > >	hard registers.
> > OK.  Extra credit for a testcase, ppc specific is obviously OK.
> 
> Thanks.  Committed revision 219786.  I'll see if I can come up with a
> reasonable testcase.

And now reverted due to Segher's objection.  Here's the testcase FWIW.
diff mbox

Patch

Index: gcc/testsuite/gcc.target/powerpc/cprophard.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/cprophard.c	(revision 0)
+++ gcc/testsuite/gcc.target/powerpc/cprophard.c	(working copy)
@@ -0,0 +1,13 @@ 
+/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler "ld 2,(24|40)\\(1\\)" } } */
+
+/* From a linux kernel mis-compile of net/core/skbuff.c.  */
+register unsigned long current_r1 asm ("r1");
+
+void f (unsigned int n, void (*fun) (unsigned long))
+{
+  while (n--)
+    (*fun) (current_r1 & -0x1000);
+}