]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/31848 (Invalid loop optimization causes bootstrap failure...
authorSteven Bosscher <steven@gcc.gnu.org>
Sat, 12 May 2007 18:12:54 +0000 (18:12 +0000)
committerSteven Bosscher <steven@gcc.gnu.org>
Sat, 12 May 2007 18:12:54 +0000 (18:12 +0000)
PR rtl-optimization/31848
* loop-invariant.c (move_invariant_reg): If we move an insn
with a REG_EQUAL note, and that insn is not always executed,
remove the REG_EQUAL note.

From-SVN: r124639

gcc/ChangeLog
gcc/loop-invariant.c

index bc7e921124fc26170aff657b040e58706dec476a..32fa23943de5074d5730eac5237c4be193b8d8ba 100644 (file)
@@ -1,3 +1,10 @@
+2007-05-12  Steven Bosscher  <steven@gcc.gnu.org>
+
+       PR rtl-optimization/31848
+       * loop-invariant.c (move_invariant_reg): If we move an insn
+       with a REG_EQUAL note, and that insn is not always executed,
+       remove the REG_EQUAL note.
+
 2007-05-12  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/31797
index 304e424cf2d7b5301cee2cd6ed997a23afd78cb2..613bfb11e2f8a3428fe83ac311694bbcb3072db0 100644 (file)
@@ -1156,9 +1156,21 @@ move_invariant_reg (struct loop *loop, unsigned invno)
         to let emit_move_insn produce a valid instruction stream.  */
       if (REG_P (dest) && !HARD_REGISTER_P (dest))
        {
+         rtx note;
+
          emit_insn_after (gen_move_insn (dest, reg), inv->insn);
          SET_DEST (set) = reg;
          reorder_insns (inv->insn, inv->insn, BB_END (preheader));
+
+         /* If there is a REG_EQUAL note on the insn we just moved, and
+            insn is in a basic block that is not always executed, the note
+            may no longer be valid after we move the insn.
+            Note that uses in REG_EQUAL notes are taken into account in
+            the computation of invariants.  Hence it is safe to retain the
+            note even if the note contains register references.  */
+         if (! inv->always_executed
+             && (note = find_reg_note (inv->insn, REG_EQUAL, NULL_RTX)))
+           remove_note (inv->insn, note);
        }
       else
        {