[llvm] [LAA] Be more precise on different store sizes (PR #122318)
Igor Kirillov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 21 07:09:50 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)) {
----------------
igogo-x86 wrote:
Before the patch, we could get into this message when:
```
// Negative distances are not plausible dependencies.
if (SE.isKnownNonPositive(Dist)) {
if (SE.isKnownNonNegative(Dist)) {
```
But that's equivalent to `Dist->isZero()`, which has a narrower range and is faster than `!SE.isKnownNonZero(Dist)`
Also, is there a difference between `TypeSize AStoreSz = DL.getTypeStoreSize(ATy);` and `uint64_t ASz = DL.getTypeAllocSize(ATy);` in our context?
https://github.com/llvm/llvm-project/pull/122318
More information about the llvm-commits
mailing list