re PR rtl-optimization/55512 (Various LRA ICEs with inline-asm)
authorVladimir Makarov <vmakarov@redhat.com>
Wed, 28 Nov 2012 17:42:39 +0000 (17:42 +0000)
committerVladimir Makarov <vmakarov@gcc.gnu.org>
Wed, 28 Nov 2012 17:42:39 +0000 (17:42 +0000)
2012-11-28  Vladimir Makarov  <vmakarov@redhat.com>

PR rtl-optimization/55512
* lra-assigns.c (assign_by_spills): Assigned arbitrary hard regs
to failed reload pseudos instead of changing asm pattern.
* lra-constraints.c (MAX_CONSTRAINT_ITERATION_NUMBER): Increase
value.

2012-11-28  Vladimir Makarov  <vmakarov@redhat.com>

PR rtl-optimization/55512
* gcc.target/i386/pr55512-[1234].c: New tests.

From-SVN: r193901

gcc/ChangeLog
gcc/lra-assigns.c
gcc/lra-constraints.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr55512-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr55512-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr55512-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr55512-4.c [new file with mode: 0644]

index 999dfb7825b75ac69a52fa3f921e8b468622bfeb..5dfe94af58940a4d951db1cc76c1d6de0220c0fd 100644 (file)
@@ -1,3 +1,11 @@
+2012-11-28  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR rtl-optimization/55512
+       * lra-assigns.c (assign_by_spills): Assigned arbitrary hard regs
+       to failed reload pseudos instead of changing asm pattern.
+       * lra-constraints.c (MAX_CONSTRAINT_ITERATION_NUMBER): Increase
+       value.
+
 2012-11-28  Markus Trippelsdorf  <markus@trippelsdorf.de>
 
        PR other/55358
 
        PR rtl-optimization/55458
        * lra-assigns.c: Include rtl-error.h.
-       (assign_by_spills): Report about asm inpossible constraints.
+       (assign_by_spills): Report about asm impossible constraints.
        * Makefile.in (lra-assigns.c): Add $(RTL_ERROR_H).
 
 2012-11-27  Paolo Bonzini  <pbonzini@redhat.com>
index 8b7dcffb52319334d8d5bdb000aca6a36fe003bf..b1d18102dc279a4ef21be71c0661cbecec7b55e6 100644 (file)
@@ -1220,8 +1220,17 @@ assign_by_spills (void)
 
          bitmap_initialize (&failed_reload_insns, &reg_obstack);
          for (i = 0; i < nfails; i++)
-           bitmap_ior_into (&failed_reload_insns,
-                            &lra_reg_info[sorted_pseudos[i]].insn_bitmap);
+           {
+             regno = sorted_pseudos[i];
+             bitmap_ior_into (&failed_reload_insns,
+                              &lra_reg_info[regno].insn_bitmap);
+             /* Assign an arbitrary hard register of regno class to
+                avoid further trouble with the asm insns.  */
+             bitmap_clear_bit (&all_spilled_pseudos, regno);
+             assign_hard_regno
+               (ira_class_hard_regs[regno_allocno_class_array[regno]][0],
+                regno);
+           }
          EXECUTE_IF_SET_IN_BITMAP (&failed_reload_insns, 0, u, bi)
            {
              insn = lra_insn_recog_data[u]->insn;
@@ -1230,9 +1239,6 @@ assign_by_spills (void)
                  asm_p = true;
                  error_for_asm (insn,
                                 "%<asm%> operand has impossible constraints");
-                 /* Avoid further trouble with this insn.      */
-                 PATTERN (insn) = gen_rtx_USE (VOIDmode, const0_rtx);
-                 lra_invalidate_insn_data (insn);
                }
            }
          lra_assert (asm_p);
index 635bb47064f8aaef5a23bf0d0e86b7d899b9a11c..128401f1b92aa19d6a6d7a85bdd4c1f75712f60c 100644 (file)
@@ -3184,7 +3184,7 @@ loc_equivalence_change_p (rtx *loc)
 
 /* Maximum allowed number of constraint pass iterations after the last
    spill pass. It is for preventing LRA cycling in a bug case.  */
-#define MAX_CONSTRAINT_ITERATION_NUMBER 15
+#define MAX_CONSTRAINT_ITERATION_NUMBER 30
 
 /* Maximum number of generated reload insns per an insn.  It is for
    preventing this pass cycling in a bug case. */
index 7625ec2f77722dd2c99a8168e0466ef5a71393f0..d9bde0a1c64176d602d7a567d400a4840c3d2645 100644 (file)
@@ -1,3 +1,8 @@
+2012-11-28  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR rtl-optimization/55512
+       * gcc.target/i386/pr55512-[1234].c: New tests.
+
 2012-11-28  Jakub Jelinek  <jakub@redhat.com>
 
        PR testsuite/55505
diff --git a/gcc/testsuite/gcc.target/i386/pr55512-1.c b/gcc/testsuite/gcc.target/i386/pr55512-1.c
new file mode 100644 (file)
index 0000000..de88f60
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (int x)
+{
+  asm goto ("" : : "r" (x), "r" (x + 1), "r" (x + 2), "r" (x + 3), /* { dg-error "operand has impossible constraints" } */
+           "r" (x + 4), "r" (x + 5), "r" (x + 6), "r" (x + 7),
+           "r" (x + 8), "r" (x + 9), "r" (x + 10), "r" (x + 11),
+           "r" (x + 12), "r" (x + 13), "r" (x + 14), "r" (x + 15) : : lab);
+  __builtin_unreachable ();
+ lab:
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr55512-2.c b/gcc/testsuite/gcc.target/i386/pr55512-2.c
new file mode 100644 (file)
index 0000000..eec2a88
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#define __builtin_unreachable() do { } while (0)
+
+int
+foo (int x)
+{
+  asm goto ("" : : "r" (x), "r" (x + 1), "r" (x + 2), "r" (x + 3), /* { dg-error "operand has impossible constraints" } */
+           "r" (x + 4), "r" (x + 5), "r" (x + 6), "r" (x + 7),
+           "r" (x + 8), "r" (x + 9), "r" (x + 10), "r" (x + 11),
+           "r" (x + 12), "r" (x + 13), "r" (x + 14), "r" (x + 15) : : lab);
+  __builtin_unreachable ();
+ lab:
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr55512-3.c b/gcc/testsuite/gcc.target/i386/pr55512-3.c
new file mode 100644 (file)
index 0000000..2a351c3
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+bar (int x)
+{
+  asm goto ("" : : "r" (x), "r" (x + 1), "r" (x + 2), "r" (x + 3), /* { dg-error "operand has impossible constraints" } */
+           "r" (x + 4), "r" (x + 5), "r" (x + 6), "r" (x + 7),
+           "r" (x + 8), "r" (x + 9), "r" (x + 10), "r" (x + 11),
+           "r" (x + 12), "r" (x + 13), "r" (x + 14), "r" (x + 15),
+           "r" (x + 16) : : lab);
+  __builtin_unreachable ();
+ lab:
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr55512-4.c b/gcc/testsuite/gcc.target/i386/pr55512-4.c
new file mode 100644 (file)
index 0000000..3fcd11c
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#define __builtin_unreachable() do { } while (0)
+
+int
+bar (int x)
+{
+  asm goto ("" : : "r" (x), "r" (x + 1), "r" (x + 2), "r" (x + 3), /* { dg-error "operand has impossible constraints" } */
+           "r" (x + 4), "r" (x + 5), "r" (x + 6), "r" (x + 7),
+           "r" (x + 8), "r" (x + 9), "r" (x + 10), "r" (x + 11),
+           "r" (x + 12), "r" (x + 13), "r" (x + 14), "r" (x + 15),
+           "r" (x + 16) : : lab);
+  __builtin_unreachable ();
+ lab:
+  return 0;
+}