X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Fcselib.c;h=d7cb355fc33f9a18bb9fcf2a96f8fac6f800c60a;hp=0c3b3a38e06e7ecc9ba55b8d1b426f3aacd86c42;hb=2dfa96e7dabc43d6f9ebf87461581e32a3f3cdcb;hpb=376a287d5002e5e9a5ed836fd2104d6f0292a09b 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));