[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
================
@@ -2061,14 +2061,12 @@ MemoryDepChecker::getDependenceDistanceStrideAndSize(
return MemoryDepChecker::Dependence::Unknown;
}
- TypeSize AStoreSz = DL.getTypeStoreSize(ATy);
- TypeSize BStoreSz = DL.getTypeStoreSize(BTy);
-
- // If store sizes are not the same, set TypeByteSize to zero, so we can check
- // it in the caller isDependent.
uint64_t ASz = DL.getTypeAllocSize(ATy);
uint64_t BSz = DL.getTypeAllocSize(BTy);
- uint64_t TypeByteSize = (AStoreSz == BStoreSz) ? BSz : 0;
+
+ // The TypeByteSize is used to scale Distance and VF. In these contexts, the
+ // only size that matters is the size of the Sink.
+ uint64_t TypeByteSize = BSz;
----------------
artagnon wrote:
So, TypeByteSize is used in couldPreventStoreLoadForward, and in the MinDistanceNeeded computation in the same way: it is used to scale distance and VF; isn't the size of the sink sufficient? It is also used in areStridedAccessesIndependent, where Distance % TypeByteSize should be zero: isn't the size of the sink sufficient here as well? Not sure why the size of the source should be considered in these cases.
https://github.com/llvm/llvm-project/pull/122318
More information about the llvm-commits
mailing list