aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index d7abe5ff654..2b4d8577326 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -3277,7 +3277,7 @@ loop_invariant_p (loop, x)
These have always been created by the unroller and are set in
the loop, hence are never invariant. */
- if (REGNO (x) >= regs->num)
+ if (REGNO (x) >= (unsigned) regs->num)
return 0;
if (regs->array[REGNO (x)].set_in_loop < 0)
@@ -8624,11 +8624,12 @@ maybe_eliminate_biv (loop, bl, eliminate_p, threshold, insn_count)
enum rtx_code code = GET_CODE (p);
basic_block where_bb = 0;
rtx where_insn = threshold >= insn_count ? 0 : p;
+ rtx note;
/* If this is a libcall that sets a giv, skip ahead to its end. */
if (GET_RTX_CLASS (code) == 'i')
{
- rtx note = find_reg_note (p, REG_LIBCALL, NULL_RTX);
+ note = find_reg_note (p, REG_LIBCALL, NULL_RTX);
if (note)
{
@@ -8646,6 +8647,8 @@ maybe_eliminate_biv (loop, bl, eliminate_p, threshold, insn_count)
}
}
}
+
+ /* Closely examine the insn if the biv is mentioned. */
if ((code == INSN || code == JUMP_INSN || code == CALL_INSN)
&& reg_mentioned_p (reg, PATTERN (p))
&& ! maybe_eliminate_biv_1 (loop, PATTERN (p), p, bl,
@@ -8657,6 +8660,12 @@ maybe_eliminate_biv (loop, bl, eliminate_p, threshold, insn_count)
bl->regno, INSN_UID (p));
break;
}
+
+ /* If we are eliminating, kill REG_EQUAL notes mentioning the biv. */
+ if (eliminate_p
+ && (note = find_reg_note (p, REG_EQUAL, NULL_RTX)) != NULL_RTX
+ && reg_mentioned_p (reg, XEXP (note, 0)))
+ remove_note (p, note);
}
if (p == loop->end)