Commit f63426af by Bernd Schmidt Committed by Bernd Schmidt

loop-iv.c (replace_single_def_regs): Look for REG_EQUAL notes...

	* loop-iv.c (replace_single_def_regs): Look for REG_EQUAL notes;
	follow chains of regs with a single definition, and allow expressions
	that are function_invariant_p.

From-SVN: r146700
parent 8b9890fa
2009-04-24 Bernd Schmidt <bernd.schmidt@analog.com>
* loop-iv.c (replace_single_def_regs): Look for REG_EQUAL notes;
follow chains of regs with a single definition, and allow expressions
that are function_invariant_p.
2009-04-24 Paolo Bonzini <bonzini@gnu.org> 2009-04-24 Paolo Bonzini <bonzini@gnu.org>
PR middle-end/39867 PR middle-end/39867
......
...@@ -1376,23 +1376,46 @@ replace_single_def_regs (rtx *reg, void *expr1) ...@@ -1376,23 +1376,46 @@ replace_single_def_regs (rtx *reg, void *expr1)
{ {
unsigned regno; unsigned regno;
df_ref adef; df_ref adef;
rtx set; rtx set, src;
rtx *expr = (rtx *)expr1; rtx *expr = (rtx *)expr1;
if (!REG_P (*reg)) if (!REG_P (*reg))
return 0; return 0;
regno = REGNO (*reg); regno = REGNO (*reg);
adef = DF_REG_DEF_CHAIN (regno); for (;;)
if (adef == NULL || DF_REF_NEXT_REG (adef) != NULL {
|| DF_REF_IS_ARTIFICIAL (adef)) rtx note;
return -1; adef = DF_REG_DEF_CHAIN (regno);
if (adef == NULL || DF_REF_NEXT_REG (adef) != NULL
|| DF_REF_IS_ARTIFICIAL (adef))
return -1;
set = single_set (DF_REF_INSN (adef));
if (set == NULL || !REG_P (SET_DEST (set))
|| REGNO (SET_DEST (set)) != regno)
return -1;
set = single_set (DF_REF_INSN (adef)); note = find_reg_equal_equiv_note (DF_REF_INSN (adef));
if (set == NULL || SET_DEST (set) != *reg || !CONSTANT_P (SET_SRC (set)))
if (note && function_invariant_p (XEXP (note, 0)))
{
src = XEXP (note, 0);
break;
}
src = SET_SRC (set);
if (REG_P (src))
{
regno = REGNO (src);
continue;
}
break;
}
if (!function_invariant_p (src))
return -1; return -1;
*expr = simplify_replace_rtx (*expr, *reg, SET_SRC (set)); *expr = simplify_replace_rtx (*expr, *reg, src);
return 1; return 1;
} }
......
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