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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 28 05:46:15 PDT 2025


================
@@ -842,19 +842,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)
----------------
artagnon wrote:

As I previously hinted, the issue is that the step recurrence of an AddRec can never have type i128, and is i164 in the worst case, due to deficiencies in SCEV. Try the following:

```llvm
  %iv.mul.2 = shl nuw nsw i128 %iv, 1
  %gep.mul.2 = getelementptr inbounds i8, ptr %A, i128 %iv.mul.2
```

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


More information about the llvm-commits mailing list