[PATCH] D14499: Inliner: Do zero-cost inlines even if above a negative threshold (PR24851)

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 10 01:50:20 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL252595: Inliner: Do zero-cost inlines even if above a negative threshold (PR24851) (authored by hans).

Changed prior to commit:
  http://reviews.llvm.org/D14499?vs=39692&id=39795#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14499

Files:
  llvm/trunk/lib/Analysis/InlineCost.cpp
  llvm/trunk/test/Transforms/Inline/zero-cost.ll

Index: llvm/trunk/lib/Analysis/InlineCost.cpp
===================================================================
--- llvm/trunk/lib/Analysis/InlineCost.cpp
+++ llvm/trunk/lib/Analysis/InlineCost.cpp
@@ -1296,7 +1296,7 @@
   else if (NumVectorInstructions <= NumInstructions / 2)
     Threshold -= (FiftyPercentVectorBonus - TenPercentVectorBonus);
 
-  return Cost < Threshold;
+  return Cost <= std::max(0, Threshold);
 }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
Index: llvm/trunk/test/Transforms/Inline/zero-cost.ll
===================================================================
--- llvm/trunk/test/Transforms/Inline/zero-cost.ll
+++ llvm/trunk/test/Transforms/Inline/zero-cost.ll
@@ -0,0 +1,17 @@
+; RUN: opt -inline -S %s | FileCheck %s
+
+define void @f() {
+entry:
+  tail call void @g()
+  unreachable
+
+; CHECK-LABEL: @f
+; CHECK-NOT: call
+; CHECK: unreachable
+}
+
+define void @g() {
+entry:
+  unreachable
+}
+


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14499.39795.patch
Type: text/x-patch
Size: 942 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151110/0cee2dfd/attachment.bin>


More information about the llvm-commits mailing list