diff mbox

Fix PR54688

Message ID 50660A20.6060203@codesourcery.com
State New
Headers show

Commit Message

Bernd Schmidt Sept. 28, 2012, 8:35 p.m. UTC
This is a bug in the new scheduler dependency breaking code. Sparc has a
slightly broken machine description using noncanonical RTL: we get MINUS
with a constant second argument. That exposes a problem in the new code,
it pretends to handle MINUS but doesn't really. Since the most important
case is the one where we're adding constants, I've removed handling of
MINUS entirely.

This also showed a potential problem with targets where
!STACK_GROWS_DOWNWARD.

I've bootstrapped and tested the following on x86_64-linux and committed
as obvious.


Bernd
diff mbox

Patch

Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(revision 191837)
+++ gcc/ChangeLog	(working copy)
@@ -1,3 +1,9 @@ 
+2012-09-20  Bernd Schmidt  <bernds@codesourcery.com>
+
+	PR bootstrap/54688
+	* sched-deps.c (parse_add_or_inc): Remove MINUS handling.  Take
+	STACK_GROWS_DOWNWARD into account.
+
 2012-09-28  Jakub Jelinek  <jakub@redhat.com>
 
 	PR target/54716
Index: gcc/sched-deps.c
===================================================================
--- gcc/sched-deps.c	(revision 191823)
+++ gcc/sched-deps.c	(working copy)
@@ -4600,8 +4600,7 @@  parse_add_or_inc (struct mem_inc_info *m
   if (!REG_P (SET_DEST (pat)))
     return false;
 
-  if (GET_CODE (SET_SRC (pat)) != PLUS
-      && GET_CODE (SET_SRC (pat)) != MINUS)
+  if (GET_CODE (SET_SRC (pat)) != PLUS)
     return false;
 
   mii->inc_insn = insn;
@@ -4629,9 +4628,14 @@  parse_add_or_inc (struct mem_inc_info *m
     }
 
   if (regs_equal && REGNO (SET_DEST (pat)) == STACK_POINTER_REGNUM)
-    /* Note that the sign has already been reversed for !before_mem.  */
-    return mii->inc_constant > 0;
-
+    {
+      /* Note that the sign has already been reversed for !before_mem.  */
+#ifdef STACK_GROWS_DOWNWARD
+      return mii->inc_constant > 0;
+#else
+      return mii->inc_constant < 0;
+#endif
+    }
   return true;
 }