[InstSimplify] Fold icmp of allocas based on offset difference
authorHanbum Park <kese111@gmail.com>
Thu, 29 Jun 2023 07:13:18 +0000 (09:13 +0200)
committerNikita Popov <npopov@redhat.com>
Thu, 29 Jun 2023 07:16:26 +0000 (09:16 +0200)
commit46a574501731dcf313f52e20cd5bc56111a2a492
tree2b7388fac6854747d3cb2086d52e2526aff76a15
parent1d7f9ce61f6e689ca63df2e36808885c873cf80b
[InstSimplify] Fold icmp of allocas based on offset difference

Strengthen the fold for icmps of non-overlapping storage, by
working on the difference of offsets, rather than considering
both offsets independently. In particular, this allows handling
comparisons of pointers to the end of equal-sized allocations.

Proofs: https://alive2.llvm.org/ce/z/Po2nL4

Differential Revision: https://reviews.llvm.org/D153752
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstSimplify/cmp-alloca-offsets.ll
llvm/test/Transforms/InstSimplify/past-the-end.ll