[PATCH] D48066: Add one more No-alias case to alias analysis.
Hal Finkel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 12 05:24:41 PDT 2018
hfinkel added a comment.
I put this on the llvm-dev thread, but to repeat it here:
In your example, we have:
3 - idx == idx => 3 == 2*idx
and you've generalized this slightly to make this:
(odd number) == 2*idx
which makes sense. I think that we can go further looking at:
n == 2*idx
and, calling computeKnownBits on n and idx, then asking whether:
knownZeros(n) == (knownZeros(idx) << 1) | 1 and
knownOnes(n) == knownOnes(idx) << 1
(please note the comment in aliasSameBasePointerGEPs regarding avoiding
PR32314)
also, if we have more than one array access, we can have:
n - idx == m - idx
then we have:
n-m == 2*idx
and so we can check:
knownZeros(n-m) == (knownZeros(idx) << 1) | 1 and
knownOnes(n-m) == knownOnes(idx) << 1
Sadly, we don't have a good API to do the knownBits check on the
subtraction of non-constants, but you only need the constants in your
case, and we can leave the more-general case for future work.
Repository:
rL LLVM
https://reviews.llvm.org/D48066
More information about the llvm-commits
mailing list