On Thu, Dec 01, 2016 at 09:47:51AM +0000, Bin Cheng wrote:
> After investigation, I believe PR78559 is a combine issue revealed by tree
> level change. Root causes is after replacing CC register use in
> undobuf.other_insn, its REG_EQUAL/REG_EQUIV notes are no longer valid because
> meaning of CC register has changed in i2/i3 instructions by combine. For
> following combine sequence, GCC would try to use the note and result in wrong
> code. This is a proposed patch discarding all REG_EQUAL/REG_EQUIV notes for
> other_insn. It might be a over-kill, but it's difficult to analyze whether
> registers have been changed or not? Bootstrap and test on x86_64 and
> AArch64, any suggestion on how to fix this?
Why is distribute_notes not called on this? (Search for "We now know",
25 lines down). Ah, it is only called on the *new* notes, and it only
deletes existing REG_DEAD/REG_UNUSED notes. You probably should delete
a REG_EQ* here if the reg it refers to is not the same anymore / does
not have the same contents. Well, except you cannot see the latter here,
so you'll have to kill the note where the SET of the CC is changed.
I'll have a look later; maybe this already helps though.