[llvm] [LAA] Prepare to handle diff type sizes v2 (NFC) (PR #161238)

Andrei Elovikov via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 28 13:46:55 PDT 2026


================
@@ -2211,8 +2209,24 @@ 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.isKnownNonPositive(Dist) &&
+      SE.isKnownNonNegative(Dist)) {
----------------
eas wrote:

I have a hard time matching this with the comment above. Based on the comment, I'd expect

```
if (AStoreSz != BStoreSz && !isKnownNonZero(Dist)
```

but if SE doesn't know anything about `Dist` (so `isKnownNonZero == false`, `!isKnownNonZero == true`), we'd have `false && false` as currently written. What do I miss?

It's also suspicious that we need special treatment for zero distance (overlapping starting for the lower byte) but not for the overlap in the high bytes.


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


More information about the llvm-commits mailing list