diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp index 9e31bb51226f8..120b2a0ef0baa 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp @@ -423,8 +423,7 @@ bool AMDGPUPromoteAllocaImpl::run(Function &F, bool PromoteToLDS) { for (AllocaAnalysis &AA : Allocas) { if (AA.Vector.Ty) { std::optional Size = AA.Alloca->getAllocationSize(*DL); - if (!Size) - continue; // Skip dynamic allocas + assert(Size); // Expected to succeed on non-array alloca. const unsigned AllocaCost = Size->getFixedValue() * 8; // First, check if we have enough budget to vectorize this alloca. if (AllocaCost <= VectorizationBudget) {