Commit 82fa5f8a by H.J. Lu

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.

From-SVN: r157539
parent eb45755f
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.
2010-03-18 Michael Matz <matz@suse.de> 2010-03-18 Michael Matz <matz@suse.de>
PR tree-optimization/43402 PR tree-optimization/43402
......
...@@ -1423,14 +1423,16 @@ move_invariant_reg (struct loop *loop, unsigned invno) ...@@ -1423,14 +1423,16 @@ move_invariant_reg (struct loop *loop, unsigned invno)
emit_insn_after (gen_move_insn (dest, reg), inv->insn); emit_insn_after (gen_move_insn (dest, reg), inv->insn);
reorder_insns (inv->insn, inv->insn, BB_END (preheader)); reorder_insns (inv->insn, inv->insn, BB_END (preheader));
/* If there is a REG_EQUAL note on the insn we just moved, and /* 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, the note insn is in a basic block that is not always executed or the note
may no longer be valid after we move the insn. contains something for which we don't know the invariant status,
Note that uses in REG_EQUAL notes are taken into account in the note may no longer be valid after we move the insn. Note that
the computation of invariants. Hence it is safe to retain the uses in REG_EQUAL notes are taken into account in the computation
note even if the note contains register references. */ of invariants, so it is safe to retain the note even if it contains
if (! inv->always_executed register references for which we know the invariant status. */
&& (note = find_reg_note (inv->insn, REG_EQUAL, NULL_RTX))) 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); remove_note (inv->insn, note);
} }
else else
......
2010-03-18 H.J. Lu <hongjiu.lu@intel.com>
PR rtl-optimization/43360
* gcc.dg/torture/pr43360.c: New.
2010-03-18 Michael Matz <matz@suse.de> 2010-03-18 Michael Matz <matz@suse.de>
PR tree-optimization/43402 PR tree-optimization/43402
......
/* { dg-do run } */
int l_5_5_2 = 4;
int g_3[1][1];
void func_1 (void)
{
for (g_3[0][0] = 1; g_3[0][0] < 8; g_3[0][0] += 7) {
int *l_6 = &g_3[0][0];
*l_6 = l_5_5_2;
}
}
int main (void)
{
func_1 ();
if (g_3[0][0] != 11)
__builtin_abort ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment