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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu May 15 13:41:53 PDT 2025


================
@@ -2127,14 +2129,15 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
     return Dependence::Forward;
   }
 
-  int64_t MinDistance = SE.getSignedRangeMin(Dist).getSExtValue();
+  std::optional<int64_t> MinDistance =
+      SE.getSignedRangeMin(Dist).trySExtValue();
   // Below we only handle strictly positive distances.
-  if (MinDistance <= 0) {
+  if (!MinDistance || MinDistance <= 0) {
     FoundNonConstantDistanceDependence |= ShouldRetryWithRuntimeCheck;
     return Dependence::Unknown;
   }
 
-  if (!ConstDist) {
+  if (!ConstDistance) {
----------------
fhahn wrote:

Can we get rid of some of the additional changes by keping the original names `ConstDistance -> ConstDist`?

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


More information about the llvm-commits mailing list