mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-20 00:20:11 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221501 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user