[llvm] LAA: improve code in a couple of routines (NFC) (PR #108092)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 28 03:45:40 PST 2024


================
@@ -2040,19 +2039,16 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
                          *Dist, MaxStride, TypeByteSize))
     return Dependence::NoDep;
 
-  const SCEVConstant *C = dyn_cast<SCEVConstant>(Dist);
+  const SCEVConstant *ConstDist = dyn_cast<SCEVConstant>(Dist);
 
   // Attempt to prove strided accesses independent.
-  if (C) {
-    const APInt &Val = C->getAPInt();
-    int64_t Distance = Val.getSExtValue();
+  if (ConstDist) {
+    int64_t Distance = std::abs(ConstDist->getAPInt().getSExtValue());
----------------
fhahn wrote:

Can we use `ConstDist->getAPInt().abs()` here as is done below?

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


More information about the llvm-commits mailing list