On Mon, Oct 15, 2012 at 9:38 AM, Paolo Bonzini wrote: >> I don't think we want to do that. A REG_EQUAL/REG_EQUIV note can use a >> pseudo that isn't live and still be valid. Consider a simple example >> like this: >> >> a = b + 3 >> // b dies here >> c = a {REG_EQUAL b+3} >> >> The REG_EQUAL note is valid and may help optimization. Removing it >> just because b is dead at that point would be unnecessarily >> pessimistic. > > I disagree that it is valid. At least it is risky to consider it valid, > because a pass that simulates liveness might end up doing something > wrong because of that note. If simulation is done backwards, it doesn't > even require any interaction with REG_DEAD notes.
In any case, if web doesn't properly rename the register in the REG_EQUAL note (which it doesn't do without my patch) and we declare such a note invalid, then we should remove the note. You're right that GCC ends up doing something wrong, that's why Honza's test case fails. With my patch, the registers in the notes are properly renamed and there are no REG_EQUAL notes that refer to dead registers, so the point whether such a note would be valid is moot. After renaming, the note is valid, and the behavior is restored that GCC had before I added DF_RD_PRUNE_DEAD_DEFS. I think we should come to a conclusion of this discussion: Either we drop the notes (e.g. by re-computing the DF_NOTE problem after web) or we update them, like my patch does. I prefer the patch I proposed because it re-instates the behavior GCC had before. Ciao! Steven