diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-11-07 00:31:14 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-11-07 00:31:14 +0000 |
commit | bf93e7c7d31dcda9d662afda35b4cbf8bd7375aa (patch) | |
tree | 9face2f4e928f1ef49e918d351d7963094348672 /llvm/lib | |
parent | 2d220ab9b4fa1ed1157fc809d0c1fc1e7ae24f8c (diff) | |
download | bcm5719-llvm-bf93e7c7d31dcda9d662afda35b4cbf8bd7375aa.tar.gz bcm5719-llvm-bf93e7c7d31dcda9d662afda35b4cbf8bd7375aa.zip |
LoopVectorize: Don't assume pointees are sized
A pointer's pointee might not be sized: the pointee could be a function.
Report this as IK_NoInduction when calculating isInductionVariable.
This fixes PR21508.
llvm-svn: 221501
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index f02cf0a55bd..0a472dc7d89 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -5265,7 +5265,13 @@ LoopVectorizationLegality::isInductionVariable(PHINode *Phi) { return IK_NoInduction; assert(PhiTy->isPointerTy() && "The PHI must be a pointer"); - uint64_t Size = DL->getTypeAllocSize(PhiTy->getPointerElementType()); + Type *PointerElementType = PhiTy->getPointerElementType(); + // The pointer stride cannot be determined if the pointer element type is not + // sized. + if (!PointerElementType->isSized()) + return IK_NoInduction; + + uint64_t Size = DL->getTypeAllocSize(PointerElementType); if (C->getValue()->equalsInt(Size)) return IK_PtrInduction; else if (C->getValue()->equalsInt(0 - Size)) |