diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -867,7 +867,7 @@ // is needed to track stack usage during inlining. Type *Ty = I.getAllocatedType(); AllocatedSize = SaturatingMultiplyAdd( - AllocSize->getLimitedValue(), DL.getTypeAllocSize(Ty).getFixedSize(), + AllocSize->getLimitedValue(), DL.getTypeAllocSize(Ty).getKnownMinSize(), AllocatedSize); if (AllocatedSize > InlineConstants::MaxSimplifiedDynamicAllocaToInline) { HasDynamicAlloca = true; @@ -881,7 +881,7 @@ if (I.isStaticAlloca()) { Type *Ty = I.getAllocatedType(); AllocatedSize = - SaturatingAdd(DL.getTypeAllocSize(Ty).getFixedSize(), AllocatedSize); + SaturatingAdd(DL.getTypeAllocSize(Ty).getKnownMinSize(), AllocatedSize); } // We will happily inline static alloca instructions. diff --git a/llvm/test/Transforms/Inline/inline-scalable.ll b/llvm/test/Transforms/Inline/inline-scalable.ll new file mode 100644 --- /dev/null +++ b/llvm/test/Transforms/Inline/inline-scalable.ll @@ -0,0 +1,11 @@ +; RUN: opt -S -inline < %s | FileCheck %s + +define void @func() { +; CHECK-LABEL: func +; CHECK-NEXT: [[VEC_ADDR:%.*]] = alloca +; CHECK-NEXT: call void @func() +; CHECK-NEXT: ret void + %vec.addr = alloca + call void @func(); + ret void +}