diff options
author | Florian Hahn <flo@fhahn.com> | 2021-11-23 17:37:12 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2021-11-23 17:37:30 +0000 |
commit | 0a00d64e322f28f5f65f5b2d507d12757883478a (patch) | |
tree | fe577516d408a07acd303ec1218482d09ad001b3 /llvm/lib/Analysis/LoopAccessAnalysis.cpp | |
parent | 065f777d2740653fac79fe44cda121bce11013b8 (diff) | |
download | llvm-0a00d64e322f28f5f65f5b2d507d12757883478a.zip llvm-0a00d64e322f28f5f65f5b2d507d12757883478a.tar.gz llvm-0a00d64e322f28f5f65f5b2d507d12757883478a.tar.bz2 |
[LAA] Turn aggregate type check into assertion (NFCI).
getPtrStride should not be called with aggregate access types. There's
also an old TODO.
Turn the check into an assertion.
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/LoopAccessAnalysis.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index f9bd716..66826e2 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -1032,15 +1032,7 @@ int64_t llvm::getPtrStride(PredicatedScalarEvolution &PSE, Type *AccessTy, bool ShouldCheckWrap) { Type *Ty = Ptr->getType(); assert(Ty->isPointerTy() && "Unexpected non-ptr"); - unsigned AddrSpace = Ty->getPointerAddressSpace(); - - // Make sure we're not accessing an aggregate type. - // TODO: Why? This doesn't make any sense. - if (AccessTy->isAggregateType()) { - LLVM_DEBUG(dbgs() << "LAA: Bad stride - Not a pointer to a scalar type" - << *Ptr << "\n"); - return 0; - } + assert(!AccessTy->isAggregateType() && "Bad stride - Not a pointer to a scalar type"); const SCEV *PtrScev = replaceSymbolicStrideSCEV(PSE, StridesMap, Ptr); @@ -1068,6 +1060,7 @@ int64_t llvm::getPtrStride(PredicatedScalarEvolution &PSE, Type *AccessTy, // An getelementptr without an inbounds attribute and unit stride would have // to access the pointer value "0" which is undefined behavior in address // space 0, therefore we can also vectorize this case. + unsigned AddrSpace = Ty->getPointerAddressSpace(); bool IsInBoundsGEP = isInBoundsGep(Ptr); bool IsNoWrapAddRec = !ShouldCheckWrap || PSE.hasNoOverflow(Ptr, SCEVWrapPredicate::IncrementNUSW) || |