aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop-iv.c
diff options
context:
space:
mode:
authorBernd Schmidt <bernd.schmidt@analog.com>2009-04-24 11:01:57 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2009-04-24 11:01:57 +0000
commitf63426afd8ce57a1148d5c6cfbe369be2a870e8b (patch)
tree4f3b7b217523d86916ed1b5a3f7c8d8d85ccf9e4 /gcc/loop-iv.c
parent8b9890fa4111e4892cac22bc6d694c56f45316cd (diff)
downloadgcc-f63426afd8ce57a1148d5c6cfbe369be2a870e8b.zip
gcc-f63426afd8ce57a1148d5c6cfbe369be2a870e8b.tar.gz
gcc-f63426afd8ce57a1148d5c6cfbe369be2a870e8b.tar.bz2
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
Diffstat (limited to 'gcc/loop-iv.c')
-rw-r--r--gcc/loop-iv.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
index 9403736..23ece7e 100644
--- a/gcc/loop-iv.c
+++ b/gcc/loop-iv.c
@@ -1376,23 +1376,46 @@ replace_single_def_regs (rtx *reg, void *expr1)
{
unsigned regno;
df_ref adef;
- rtx set;
+ rtx set, src;
rtx *expr = (rtx *)expr1;
if (!REG_P (*reg))
return 0;
regno = REGNO (*reg);
- adef = DF_REG_DEF_CHAIN (regno);
- if (adef == NULL || DF_REF_NEXT_REG (adef) != NULL
- || DF_REF_IS_ARTIFICIAL (adef))
- return -1;
+ for (;;)
+ {
+ rtx note;
+ 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));
- if (set == NULL || SET_DEST (set) != *reg || !CONSTANT_P (SET_SRC (set)))
+ note = find_reg_equal_equiv_note (DF_REF_INSN (adef));
+
+ 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;
- *expr = simplify_replace_rtx (*expr, *reg, SET_SRC (set));
+ *expr = simplify_replace_rtx (*expr, *reg, src);
return 1;
}