[llvm] [LAA] Allow vectorizing `A[NonZeroNonConstantStride*I] += 1` (PR #186262)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 29 01:08:35 PDT 2026
================
@@ -1691,7 +1693,23 @@ std::optional<int64_t> llvm::getPtrStride(
LLVM_DEBUG(
dbgs() << "LAA: Bad stride - Pointer may wrap in the address space "
<< *Ptr << " SCEV: " << *AR << "\n");
- return std::nullopt;
+ return nullptr;
+}
+
+/// Check whether the access through \p Ptr has a constant stride.
+std::optional<int64_t> llvm::getPtrStride(
+ PredicatedScalarEvolution &PSE, Type *AccessTy, Value *Ptr, const Loop *Lp,
+ const DominatorTree &DT, const DenseMap<Value *, const SCEV *> &StridesMap,
+ bool ShouldCheckWrap, SmallVectorImpl<const SCEVPredicate *> *Predicates) {
+ const SCEV *StrideScev = getPtrStrideScev(
+ PSE, AccessTy, Ptr, Lp, DT, StridesMap, ShouldCheckWrap, Predicates);
+ if (!StrideScev)
+ return std::nullopt;
+ const APInt *APStride = nullptr;
----------------
artagnon wrote:
```suggestion
const APInt *APStride;
```
Initialized in match?
https://github.com/llvm/llvm-project/pull/186262
More information about the llvm-commits
mailing list