[PATCH] D39835: [GVN PRE] Clear nsw/nuw for original values in LoadPRE

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 13:54:12 PST 2017


>
>
> I can't tell from your example enough detail to know what you're aiming
> for, but if there's a bug here, it's in replacing the add, not forming the
> phi node.
>

I believe you have missed the point, so i'll make it a little later.


>
> > patchAndReplaceAlluses will not remove the nsw from the phi in this case.
> >  We could teach it to do so.
> >  The other option is this patch, and fixing load PRE when it creates the
> phi in the first place.
>
> The phi is entirely correct and could be hand written.  If GVN is
> considering adds with different flags equivalent without appropriate
> backpatching, that's a bug in GVN's replacement.

End of story.
>

Sure, but there is nowhere else to fix it.
When GVN does replacement, it assumes every instruction it is replacing
with has already been fixed.
It has no way of saying "hey, somewhere in the chain of this instruction
may be something you may have to fix later".

It is not recursive in patching at all.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171205/a5675253/attachment.html>


More information about the llvm-commits mailing list