[llvm] [LAA] Clean up APInt-overflow related code (NFC) (PR #140048)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Thu May 15 09:15:29 PDT 2025


================
@@ -2067,14 +2064,17 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
     return Dependence::NoDep;
 
   // Attempt to prove strided accesses independent.
-  const APInt *ConstDist = nullptr;
-  if (match(Dist, m_scev_APInt(ConstDist))) {
-    uint64_t Distance = ConstDist->abs().getZExtValue();
+  const APInt *APDist = nullptr;
+  std::optional<uint64_t> ConstDistance = match(Dist, m_scev_APInt(APDist))
+                                              ? APDist->abs().tryZExtValue()
+                                              : std::nullopt;
 
+  if (ConstDistance) {
     // If the distance between accesses and their strides are known constants,
     // check whether the accesses interlace each other.
-    if (Distance > 0 && CommonStride && CommonStride > 1 && HasSameSize &&
-        areStridedAccessesIndependent(Distance, *CommonStride, TypeByteSize)) {
+    if (ConstDistance > 0 && CommonStride && CommonStride > 1 && HasSameSize &&
----------------
alexey-bataev wrote:

```suggestion
    if (*ConstDistance > 0 && CommonStride && CommonStride > 1 && HasSameSize &&
```

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


More information about the llvm-commits mailing list