[PATCH] D85848: [InlineCost] Fix scalable vectors in visitAlloca

Cullen Rhodes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 03:35:12 PDT 2020


This revision was automatically updated to reflect the committed changes.
c-rhodes marked an inline comment as done.
Closed by commit rG2ccde3c96b78: [InlineCost] Fix scalable vectors in visitAlloca (authored by c-rhodes).

Repository:
  rG LLVM Github Monorepo

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.285953.patch
Type: text/x-patch
Size: 1484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200817/0ad21c7a/attachment.bin>


More information about the llvm-commits mailing list