[PATCH] D85848: [InlineCost] Fix scalable vectors in visitAlloca
Cullen Rhodes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 14 07:02:31 PDT 2020
c-rhodes updated this revision to Diff 285644.
c-rhodes retitled this revision from "[InlineCost] Skip scalable vectors in visitAlloca" to "[InlineCost] Fix scalable vectors in visitAlloca".
c-rhodes added a comment.
Replace `getFixedSize` with `getKnownMinSize` rather than skipping scalable vectors.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85848/new/
https://reviews.llvm.org/D85848
Files:
llvm/lib/Analysis/InlineCost.cpp
llvm/test/Transforms/Inline/inline-scalable.ll
Index: llvm/test/Transforms/Inline/inline-scalable.ll
===================================================================
--- /dev/null
+++ 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 <vscale x 4 x i32>
+; CHECK-NEXT: call void @func()
+; CHECK-NEXT: ret void
+ %vec.addr = alloca <vscale x 4 x i32>
+ call void @func();
+ ret void
+}
Index: llvm/lib/Analysis/InlineCost.cpp
===================================================================
--- llvm/lib/Analysis/InlineCost.cpp
+++ 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85848.285644.patch
Type: text/x-patch
Size: 1484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200814/9b1d4590/attachment.bin>
More information about the llvm-commits
mailing list