[llvm] [LAA] Be more precise on different store sizes (PR #122318)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 21 09:49:35 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)) {
----------------
fhahn wrote:

`Dist->isZero()` is only true for constant zero distances I think, while the current code supports additional cases where we can prove that a value is non-zero via other means (e.g. consider `umax 1, %x`)

https://github.com/llvm/llvm-project/pull/122318


More information about the llvm-commits mailing list