re PR rtl-optimization/56484 (ICE in assign_by_spills, at lra-assigns.c:1268)
authorJakub Jelinek <jakub@gcc.gnu.org>
Tue, 5 Mar 2013 22:25:43 +0000 (23:25 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 5 Mar 2013 22:25:43 +0000 (23:25 +0100)
PR rtl-optimization/56484
* ifcvt.c (noce_process_if_block): If else_bb is NULL, avoid extending
lifetimes of hard registers on small register class machines.

From-SVN: r196478

gcc/ifcvt.c
gcc/testsuite/gcc.c-torture/compile/pr56484.c [new file with mode: 0644]

index dd941006535f3dd6fce873bf80bf291fdd12c3fa..f081ecd33534a9e57a25b7c411333ff9bf1b74c4 100644 (file)
@@ -2491,6 +2491,12 @@ noce_process_if_block (struct noce_if_info *if_info)
          || ! noce_operand_ok (SET_SRC (set_b))
          || reg_overlap_mentioned_p (x, SET_SRC (set_b))
          || modified_between_p (SET_SRC (set_b), insn_b, jump)
+         /* Avoid extending the lifetime of hard registers on small
+            register class machines.  */
+         || (REG_P (SET_SRC (set_b))
+             && HARD_REGISTER_P (SET_SRC (set_b))
+             && targetm.small_register_classes_for_mode_p
+                  (GET_MODE (SET_SRC (set_b))))
          /* Likewise with X.  In particular this can happen when
             noce_get_condition looks farther back in the instruction
             stream than one might expect.  */
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr56484.c b/gcc/testsuite/gcc.c-torture/compile/pr56484.c
new file mode 100644 (file)
index 0000000..894862c
--- /dev/null
@@ -0,0 +1,17 @@
+/* PR rtl-optimization/56484 */
+
+unsigned char b[4096];
+int bar (void);
+
+int
+foo (void)
+{
+  int a = 0;
+  while (bar ())
+    {
+      int c = bar ();
+      a = a < 0 ? a : c;
+      __builtin_memset (b, 0, sizeof b);
+    }
+  return a;
+}