summaryrefslogtreecommitdiff
path: root/gcc/loop-invariant.c
diff options
context:
space:
mode:
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2010-03-18 13:10:49 +0000
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2010-03-18 13:10:49 +0000
commit2521c0845d8e7b2718a0d50afab07989a98a0893 (patch)
tree2e9989fbc201d38d90f3ecc75bcfe7e74cb4b8ef /gcc/loop-invariant.c
parent5d8d76f6177adce94026908252cd6055676b1f1c (diff)
downloadgcc-2521c0845d8e7b2718a0d50afab07989a98a0893.tar.gz
Remove the REG_EQUAL note if we don't know its invariant status.
gcc/ 2010-03-18 Steven Bosscher <steven@gcc.gnu.org> Eric Botcazou <ebotcazou@adacore.com> PR rtl-optimization/43360 * loop-invariant.c (move_invariant_reg): Remove the REG_EQUAL note if we don't know its invariant status. gcc/testsuite/ 2010-03-18 H.J. Lu <hongjiu.lu@intel.com> PR rtl-optimization/43360 * gcc.dg/torture/pr43360.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157539 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop-invariant.c')
-rw-r--r--gcc/loop-invariant.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index 03f0a13baa0..57973c19523 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -1423,14 +1423,16 @@ move_invariant_reg (struct loop *loop, unsigned invno)
emit_insn_after (gen_move_insn (dest, reg), inv->insn);
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)))
+ /* If there is a REG_EQUAL note on the insn we just moved, and the
+ insn is in a basic block that is not always executed or the note
+ contains something for which we don't know the invariant status,
+ 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, so it is safe to retain the note even if it contains
+ register references for which we know the invariant status. */
+ if ((note = find_reg_note (inv->insn, REG_EQUAL, NULL_RTX))
+ && (!inv->always_executed
+ || !check_maybe_invariant (XEXP (note, 0))))
remove_note (inv->insn, note);
}
else