[PATCH] Merge adjacent stores of constants (PR middle-end/22141)
Steven Bosscher
stevenb.gcc@gmail.com
Fri Nov 28 14:01:00 GMT 2008
Xf. http://gcc.gnu.org/ml/gcc-patches/2008-11/msg01413.html
> > I wonder
> > if I could trust REG_EQUAL notes containing CONST_INT that forwprop
> > generates (and in which case to trust them? Only if the insn is
> > single_set?).
>
> Yes, you can trust them if the insn is single_set.
Yup. In fact...
> If it is not, they
> probably do not come from fwprop (and I never really understood when are
> they valid for non-single_set insns).
...and any place where they do come from is buggy, because this is not valid..
Any REG_EQUAL note on a non-single_set() insn is a bug. From
emit-rtl.c:set_unique_reg_note():
rtx
set_unique_reg_note (rtx insn, enum reg_note kind, rtx datum)
{
rtx note = find_reg_note (insn, kind, NULL_RTX);
switch (kind)
{
case REG_EQUAL:
case REG_EQUIV:
/* Don't add REG_EQUAL/REG_EQUIV notes if the insn
has multiple sets (some callers assume single_set
means the insn only has one set, when in fact it
means the insn only has one * useful * set). */
if (GET_CODE (PATTERN (insn)) == PARALLEL && multiple_sets (insn))
{
gcc_assert (!note);
return NULL_RTX;
}
...
Indeed, it is a bug if we set REG_EQUAL notes from anywhere without
going through set_unique_reg_note().
Gr.
Steven
More information about the Gcc-patches
mailing list