[InstSimplify] Strip offsets once in computePointerICmp()
authorNikita Popov <npopov@redhat.com>
Tue, 15 Feb 2022 11:00:47 +0000 (12:00 +0100)
committerNikita Popov <npopov@redhat.com>
Tue, 15 Feb 2022 11:04:24 +0000 (12:04 +0100)
commitf35af77573d9e80bf6e61b3fdd20fe55191e962f
tree6674f964c84e765dcd907a0d26ed2a8d84fe55cb
parenteccdf2d9b1286a976943489acb1642f5d7b35334
[InstSimplify] Strip offsets once in computePointerICmp()

Instead of doing an inbounds strip first and another non-inbounds
strip afterward for equality comparisons, directly do a single
inbounds or non-inbounds strip based on whether we have an equality
predicate or not.

This is NFC-ish in that the alloca equality codepath is the only
part that sees additional non-inbounds offsets now, and for that
codepath it doesn't matter whether or not the GEP is inbounds, as
it does a stronger check itself. InstCombine would infer inbounds
for such GEPs.
llvm/lib/Analysis/InstructionSimplify.cpp