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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 30 01:42:04 PDT 2025


================
@@ -948,19 +948,12 @@ getStrideFromAddRec(const SCEVAddRecExpr *AR, const Loop *Lp, Type *AccessTy,
   TypeSize AllocSize = DL.getTypeAllocSize(AccessTy);
   int64_t Size = AllocSize.getFixedValue();
 
-  // Huge step value - give up.
-  if (APStepVal->getBitWidth() > 64)
+  std::optional<int64_t> StepVal = APStepVal->trySExtValue();
----------------
fhahn wrote:

```suggestion
  // Huge step value - give up.
  std::optional<int64_t> StepVal = APStepVal->trySExtValue();
```

Retain comment as some sort of explanation for the bail-out; it is not needed for correctness

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


More information about the llvm-commits mailing list