diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-02-14 12:21:33 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-02-14 12:21:33 +0000 |
commit | ae1d0cccc1e85120593b6e0e2d104297a6ab44a0 (patch) | |
tree | 75baedbe3aa17902f83a98bd7fde364ba51238d1 /gcc/cselib.c | |
parent | 5e6ca8f01ffff075d1c82f7629125df9ef110fe8 (diff) | |
download | gcc-ae1d0cccc1e85120593b6e0e2d104297a6ab44a0.tar.gz |
2012-02-14 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 184203 using svnmerge
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@184207 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cselib.c')
-rw-r--r-- | gcc/cselib.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/gcc/cselib.c b/gcc/cselib.c index 0c3b3a38e06..d7cb355fc33 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -1372,8 +1372,18 @@ expand_loc (struct elt_loc_list *p, struct expand_value_data *evd, unsigned int regno = UINT_MAX; struct elt_loc_list *p_in = p; - for (; p; p = p -> next) + for (; p; p = p->next) { + /* Return these right away to avoid returning stack pointer based + expressions for frame pointer and vice versa, which is something + that would confuse DSE. See the comment in cselib_expand_value_rtx_1 + for more details. */ + if (REG_P (p->loc) + && (REGNO (p->loc) == STACK_POINTER_REGNUM + || REGNO (p->loc) == FRAME_POINTER_REGNUM + || REGNO (p->loc) == HARD_FRAME_POINTER_REGNUM + || REGNO (p->loc) == cfa_base_preserved_regno)) + return p->loc; /* Avoid infinite recursion trying to expand a reg into a the same reg. */ if ((REG_P (p->loc)) @@ -1895,6 +1905,19 @@ cselib_subst_to_values (rtx x, enum machine_mode memmode) return copy; } +/* Wrapper for cselib_subst_to_values, that indicates X is in INSN. */ + +rtx +cselib_subst_to_values_from_insn (rtx x, enum machine_mode memmode, rtx insn) +{ + rtx ret; + gcc_assert (!cselib_current_insn); + cselib_current_insn = insn; + ret = cselib_subst_to_values (x, memmode); + cselib_current_insn = NULL; + return ret; +} + /* Look up the rtl expression X in our tables and return the value it has. If CREATE is zero, we return NULL if we don't know the value. Otherwise, we create a new one if possible, using mode MODE if X @@ -2688,8 +2711,11 @@ dump_cselib_val (void **x, void *info) fputs (" locs:", out); do { - fprintf (out, "\n from insn %i ", - INSN_UID (l->setting_insn)); + if (l->setting_insn) + fprintf (out, "\n from insn %i ", + INSN_UID (l->setting_insn)); + else + fprintf (out, "\n "); print_inline_rtx (out, l->loc, 4); } while ((l = l->next)); |