This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Merge adjacent stores of constants (PR middle-end/22141)
- From: "Steven Bosscher" <stevenb dot gcc at gmail dot com>
- To: "Paolo Bonzini" <bonzini at gnu dot org>, "Jakub Jelinek" <jakub at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 28 Nov 2008 11:29:48 +0100
- Subject: Re: [PATCH] Merge adjacent stores of constants (PR middle-end/22141)
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