prevent REG_EQUAL on set-mem insns
Olivier Hainque
hainque@adacore.com
Mon Sep 13 11:44:00 GMT 2010
Olivier Hainque wrote:
> > I think it would be a good idea to add some code to
> > set_unique_reg_note for good measure.
>
> Agreed. I see Richard approved the current version so I'll start
> with this, then test an assert in set_unique_reg_note.
Preliminary results (bootstrap on x86_64-linux) with an assert
exposed several other offenders rapidly.
The first two to show up were in optabs.c, and there are other
candidates here.
This suggests an alternate track: instead of asserting REG_P (dest)
from set_unique_reg_note, maybe just not setting the note when the
predicate doesn't hold would be more sensible.
There are a couple of similar guards already:
/* Don't add REG_EQUAL/REG_EQUIV notes if the insn
has multiple sets ... */
...
/* Don't add ASM_OPERAND REG_EQUAL/REG_EQUIV notes. ... */
...
We have two pretty different approaches then:
1 assert in set_unique_reg_note and fix all callers as they show up,
2 adjust set_unique_reg_note to not set the note when it's invalid,
and leave callers alone (except maybe the most obvious ones).
I'm not clear if the latter could raise correctness concerns. I hope
not.
If it does, a third option would be to modify the meaning of REG_EQUAL
(to become valid for e.g. MEM destinations), maybe then name it differently
or add another note kind for that purpose, revisit all the uses etc. Ug.
I'll experiment with option 2 a bit. Thoughts welcome :)
Olivier
More information about the Gcc-patches
mailing list