[llvm] [LAA] Be more precise on different store sizes (PR #122318)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 21 10:20:54 PDT 2025
================
@@ -2091,6 +2089,17 @@ MemoryDepChecker::getDependenceDistanceStrideAndSize(
return Dependence::Unknown;
}
+ // When the distance is possibly zero, we're reading/writing the same memory
+ // location: if the store sizes are not equal, fail with an unknown
+ // dependence.
+ TypeSize AStoreSz = DL.getTypeStoreSize(ATy);
+ TypeSize BStoreSz = DL.getTypeStoreSize(BTy);
+ if (AStoreSz != BStoreSz && !SE.isKnownNonZero(Dist)) {
----------------
artagnon wrote:
I think `SE.isKnownNon{Positive,Negative}` is equivalent to `!SE.isKnownNonZero`. As @fhahn mentions, isZero is too narrow, and can miss cases when the distance could be zero. Yes, store size is different from alloc size, although one can be computed from the other (see the corresponding functions).
https://github.com/llvm/llvm-project/pull/122318
More information about the llvm-commits
mailing list