]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/13031 (ICE (unrecognizable insn) when building gnome-libs...
authorRoger Sayle <roger@eyesopen.com>
Sat, 20 Dec 2003 19:59:56 +0000 (19:59 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Sat, 20 Dec 2003 19:59:56 +0000 (19:59 +0000)
PR optimization/13031
* gcse.c (cprop_jump): Backport code clean-up and bug-fix
from mainline [2003-05-20 Sayle, Hirata and Rennecke patch].
(cprop_insn): Don't attemp further substitutions if the
current instruction has been deleted.
(local_cprop_pass): Likewise.

* gcc.c-torture/compile/20031220-1.c: New test case.

From-SVN: r74891

gcc/ChangeLog
gcc/gcse.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20031220-1.c [new file with mode: 0644]

index 0365ba41fe305f3a748dd81e2eb10300fe98b4a6..502b6595999124eda3dd72bdefd9a375e5360062 100644 (file)
@@ -1,3 +1,12 @@
+2003-12-20  Roger Sayle  <roger@eyesopen.com>
+
+       PR optimization/13031
+       * gcse.c (cprop_jump): Backport code clean-up and bug-fix
+       from mainline [2003-05-20 Sayle, Hirata and Rennecke patch].
+       (cprop_insn): Don't attemp further substitutions if the
+       current instruction has been deleted.
+       (local_cprop_pass): Likewise.
+
 2003-12-19  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/13239
index d65914d341f5c9493c7cfdccff26986e0f93a399..12c9ac82243980762ae2678dc3c747c87a9a3860 100644 (file)
@@ -4063,28 +4063,29 @@ cprop_jump (bb, setcc, jump, from, src)
      rtx from;
      rtx src;
 {
-  rtx new, new_set;
+  rtx new;
   rtx set = pc_set (jump);
+  rtx set_src = SET_SRC (set);
 
   /* First substitute in the INSN condition as the SET_SRC of the JUMP,
      then substitute that given values in this expanded JUMP.  */
-  if (setcc != NULL
+  if (setcc != NULL_RTX
       && !modified_between_p (from, setcc, jump)
       && !modified_between_p (src, setcc, jump))
     {
       rtx setcc_set = single_set (setcc);
-      new_set = simplify_replace_rtx (SET_SRC (set),
+      set_src = simplify_replace_rtx (set_src,
                                      SET_DEST (setcc_set),
                                      SET_SRC (setcc_set));
     }
   else
-    new_set = set;
+    setcc = NULL_RTX;
 
-  new = simplify_replace_rtx (new_set, from, src);
+  new = simplify_replace_rtx (set_src, from, src);
 
   /* If no simplification can be made, then try the next
      register.  */
-  if (rtx_equal_p (new, new_set) || rtx_equal_p (new, SET_SRC (set)))
+  if (rtx_equal_p (new, SET_SRC (set)))
     return 0;
 
   /* If this is now a no-op delete it, otherwise this must be a valid insn.  */
@@ -4235,6 +4236,8 @@ cprop_insn (insn, alter_jumps)
                  print_rtl (gcse_file, src);
                  fprintf (gcse_file, "\n");
                }
+             if (INSN_DELETED_P (insn))
+               return 1;
            }
        }
       else if (GET_CODE (src) == REG
@@ -4477,6 +4480,8 @@ local_cprop_pass (alter_jumps)
                    changed = true;
                    break;
                  }
+             if (INSN_DELETED_P (insn))
+               break;
            }
          while (reg_use_count);
        }
index 9c7cab82cab19c30c8673b98e28a71eb51e8707f..8d775c8c3947bbdb04970f243a47e955356bc986 100644 (file)
@@ -1,3 +1,8 @@
+2003-12-20  Roger Sayle  <roger@eyesopen.com>
+
+       PR optimization/13031
+       * gcc.c-torture/compile/20031220-1.c: New test case.
+
 2003-12-19  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/13239
diff --git a/gcc/testsuite/gcc.c-torture/compile/20031220-1.c b/gcc/testsuite/gcc.c-torture/compile/20031220-1.c
new file mode 100644 (file)
index 0000000..026a268
--- /dev/null
@@ -0,0 +1,21 @@
+/* PR optimization/13031  */
+/* The following code used to ICE on alphaev67-*-* at -O2 with an
+   unrecognizable instruction, caused by local register allocation
+   substituting a register for a constant in a conditional branch.  */
+
+void emit(int, int);
+int f(void);
+static int signals[5];
+
+static inline void select(int sel, void *klass)
+{
+  emit(klass ? 0 : f(), signals[sel ? 0 : 1]);
+}
+
+void all(void *gil, void *l, void *icon)
+{
+  while (l)
+    if (icon)
+      select(0, gil);
+}
+