diff options
author | Benjamin Maxwell <benjamin.maxwell@arm.com> | 2025-08-19 06:40:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-19 06:40:07 +0100 |
commit | bb3066d42b42a3e6deaf69bcfabf8597018ec44b (patch) | |
tree | 8887c3a2a5041e6eec0ebe70f3ecc98e06e8c56e /llvm/lib/Analysis/LoopAccessAnalysis.cpp | |
parent | 18123cc91d7dd65dc87839227abbfdd456c4fcba (diff) | |
download | llvm-bb3066d42b42a3e6deaf69bcfabf8597018ec44b.zip llvm-bb3066d42b42a3e6deaf69bcfabf8597018ec44b.tar.gz llvm-bb3066d42b42a3e6deaf69bcfabf8597018ec44b.tar.bz2 |
[LAA] Move scalable vector check into `getStrideFromAddRec()` (#154013)
This moves the check closer to the `.getFixedValue()` call and fixes
#153797 (which is a regression from #126971).
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/LoopAccessAnalysis.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index 62baf9b..bceddd0 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -936,6 +936,12 @@ private: static std::optional<int64_t> getStrideFromAddRec(const SCEVAddRecExpr *AR, const Loop *Lp, Type *AccessTy, Value *Ptr, PredicatedScalarEvolution &PSE) { + if (isa<ScalableVectorType>(AccessTy)) { + LLVM_DEBUG(dbgs() << "LAA: Bad stride - Scalable object: " << *AccessTy + << "\n"); + return std::nullopt; + } + // The access function must stride over the innermost loop. if (Lp != AR->getLoop()) { LLVM_DEBUG({ @@ -1590,11 +1596,6 @@ llvm::getPtrStride(PredicatedScalarEvolution &PSE, Type *AccessTy, Value *Ptr, return 0; assert(Ptr->getType()->isPointerTy() && "Unexpected non-ptr"); - if (isa<ScalableVectorType>(AccessTy)) { - LLVM_DEBUG(dbgs() << "LAA: Bad stride - Scalable object: " << *AccessTy - << "\n"); - return std::nullopt; - } const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(PtrScev); if (Assume && !AR) |