diff options
Diffstat (limited to 'llvm/lib/Analysis/MemoryBuiltins.cpp')
-rw-r--r-- | llvm/lib/Analysis/MemoryBuiltins.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp index 46a7a921..8ca15434 100644 --- a/llvm/lib/Analysis/MemoryBuiltins.cpp +++ b/llvm/lib/Analysis/MemoryBuiltins.cpp @@ -1138,8 +1138,8 @@ SizeOffsetValue ObjectSizeOffsetEvaluator::visitAllocaInst(AllocaInst &I) { if (!I.getAllocatedType()->isSized()) return ObjectSizeOffsetEvaluator::unknown(); - // must be a VLA - assert(I.isArrayAllocation()); + // must be a VLA or vscale. + assert(I.isArrayAllocation() || I.getAllocatedType()->isScalableTy()); // If needed, adjust the alloca's operand size to match the pointer indexing // size. Subsequent math operations expect the types to match. @@ -1149,8 +1149,8 @@ SizeOffsetValue ObjectSizeOffsetEvaluator::visitAllocaInst(AllocaInst &I) { assert(ArraySize->getType() == Zero->getType() && "Expected zero constant to have pointer index type"); - Value *Size = ConstantInt::get(ArraySize->getType(), - DL.getTypeAllocSize(I.getAllocatedType())); + Value *Size = Builder.CreateTypeSize( + ArraySize->getType(), DL.getTypeAllocSize(I.getAllocatedType())); Size = Builder.CreateMul(Size, ArraySize); return SizeOffsetValue(Size, Zero); } |