[ARM] PR target/71436: Restrict *load_multiple pattern till after LRA
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>
Thu, 23 Mar 2017 14:55:48 +0000 (14:55 +0000)
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>
Thu, 23 Mar 2017 14:55:48 +0000 (14:55 +0000)
PR target/71436
* config/arm/arm.md (*load_multiple): Add reload_completed to
matching condition.

* gcc.c-torture/compile/pr71436.c: New test.

From-SVN: r246419

gcc/ChangeLog
gcc/config/arm/arm.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr71436.c [new file with mode: 0644]

index 091d78ab739cbb3bf52f2539cdb999e8b4c76963..98254eb4c80651fc874845020578ae29043660e9 100644 (file)
@@ -1,3 +1,9 @@
+2017-03-23  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       PR target/71436
+       * config/arm/arm.md (*load_multiple): Add reload_completed to
+       matching condition.
+
 2017-03-23  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
             Richard Biener  <rguenth@suse.com>
 
index 8720a7178d3efdad489ad27d7dca788005dd19ee..71cc109e102255f36f26e449c5ae23f1188872b6 100644 (file)
 
 ;; Patterns in ldmstm.md don't cover more than 4 registers. This pattern covers
 ;; large lists without explicit writeback generated for APCS_FRAME epilogue.
+;; The operands are validated through the load_multiple_operation
+;; match_parallel predicate rather than through constraints so enable it only
+;; after reload.
 (define_insn "*load_multiple"
   [(match_parallel 0 "load_multiple_operation"
     [(set (match_operand:SI 2 "s_register_operand" "=rk")
           (mem:SI (match_operand:SI 1 "s_register_operand" "rk")))
         ])]
-  "TARGET_32BIT"
+  "TARGET_32BIT && reload_completed"
   "*
   {
     arm_output_multireg_pop (operands, /*return_pc=*/false,
index 257c5ce832abffc44d0e93e091b42e1bb9b864c7..14b751620388515ea6301e27e3f94dadd94e02f2 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-23  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       PR target/71436
+       * gcc.c-torture/compile/pr71436.c: New test.
+
 2017-03-23  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
             Richard Biener  <rguenther@suse.de>
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr71436.c b/gcc/testsuite/gcc.c-torture/compile/pr71436.c
new file mode 100644 (file)
index 0000000..ab08d5d
--- /dev/null
@@ -0,0 +1,35 @@
+/* PR target/71436.  */
+
+#pragma pack(1)
+struct S0
+{
+  volatile int f0;
+  short f2;
+};
+
+void foo (struct S0 *);
+int a, d;
+static struct S0 b[5];
+static struct S0 c;
+void fn1 ();
+void
+main ()
+{
+  {
+    struct S0 e;
+    for (; d; fn1 ())
+      {
+        {
+          a = 3;
+          for (; a >= 0; a -= 1)
+            {
+              {
+                e = c;
+              }
+              b[a] = e;
+            }
+        }
+      }
+  }
+  foo (b);
+}