This is an archive of the discontinued LLVM Phabricator instance.

[InstSimplify] Remove incorrect icmp of gep fold (PR52429)
ClosedPublic

Authored by nikic on Nov 6 2021, 4:58 AM.

Details

Summary

As described in https://bugs.llvm.org/show_bug.cgi?id=52429 this fold is incorrect, because inbounds only guarantees that the pointers don't wrap in the unsigned space, it is possible that the sign boundary is crossed by an object.

I'm dropping the fold entirely rather than adjusting it, because computePointerICmp() fully subsumes it (with correct predicate handling).

Diff Detail

Event Timeline

nikic created this revision.Nov 6 2021, 4:58 AM
nikic requested review of this revision.Nov 6 2021, 4:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 6 2021, 4:58 AM
RKSimon added a subscriber: RKSimon.Nov 6 2021, 5:08 AM
RKSimon added inline comments.
llvm/test/Transforms/InstCombine/icmp-custom-dl.ll
163

Maybe add comments explaining why we don't fold each of these?

nikic updated this revision to Diff 385280.Nov 6 2021, 8:40 AM

Add comments

nlopes accepted this revision.Nov 6 2021, 8:50 AM

LGTM, thanks!

This revision is now accepted and ready to land.Nov 6 2021, 8:50 AM
This revision was automatically updated to reflect the committed changes.