summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-12 18:12:54 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-12 18:12:54 +0000
commitbc25a2eef2c843af08c98b674faf58d47c5dc07d (patch)
tree1115b283c5b1e47c20dfa757f86f592908a44f18 /gcc
parent3ae2779cfde8af1a2190cb58cc1f6482cf95d8b0 (diff)
downloadgcc-bc25a2eef2c843af08c98b674faf58d47c5dc07d.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124639 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/loop-invariant.c12
2 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bc7e921124f..32fa23943de 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index 304e424cf2d..613bfb11e2f 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -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
{