[BasicAA] Handle known non-zero variable index
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 10 Dec 2020 21:29:33 +0000 (22:29 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Sun, 13 Dec 2020 12:20:05 +0000 (13:20 +0100)
commitbb939ebfd7f48a1aa744941d6de86e69d3796b5d
tree7378a5760aad624f3f442f835487acd35e78bcd0
parent05d1729232cdff323cafd469532504aa85740967
[BasicAA] Handle known non-zero variable index

BasicAA currently handles cases like Scale*V0 + (-Scale)*V1 where
V0 != V1, but does not handle the simpler case of Scale*V with
V != 0. Add it based on an isKnownNonZero() call.

I'm not passing a context instruction for now, because the existing
approach of always using GEP1 for context could result in symmetry
issues.

Differential Revision: https://reviews.llvm.org/D93162
llvm/lib/Analysis/BasicAliasAnalysis.cpp
llvm/test/Analysis/BasicAA/bug.23626.ll
llvm/test/Analysis/BasicAA/sequential-gep.ll