https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94873
rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rsandifo at gcc dot gnu.org
--- Comment #6 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org>
---
(In reply to Jeffrey A. Law from comment #5)
> I can't see how a REG_EQUAL note on an insn with multiple outputs can
> possibly work -- we wouldn't know what output the REG_EQUAL note refers to.
> And we have to consider an embedded side effect as having an output.
>
> Or to think of it another way, any embedded side effect can be implemented
> with a parallel at which point it's painfully obvious the insn has multiple
> outputs and a REG_EQUAL note would be inappropriate.
Yeah, I can see that argument, but to play devil's advocate:
I think the requirement for having a single REG SET_DEST makes
sense because the REG_EQUAL note would be genuinely ambiguous if
there were multiple REG SET_DESTs. But in the case of a REG_INC
insn with a single REG SET_DEST, there's no ambiguity about which
register is meant.
I guess there's also the problem that stack pushes don't need a
REG_INC note, so anything we do can't just be keyed off REG_INC.
The only sure way to check whether a register is set as a side-effect
is to look at the complete pattern (like dse.c:check_for_inc_dec).
So I think there's the argument that optimisers have to be wary
of this in the same way that they need to be wary of folding:
(set (reg X)
(and (mem (pre_inc (reg Y)))
(reg Z)))
into
(set (reg X) (const_int 0))
when Z can be proven to be zero.