[PATCH] D23222: Changed sign of LastCallToStaticBouns

Piotr Padlewski via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 13:49:16 PDT 2016


Prazek updated this revision to Diff 67012.
Prazek added a comment.

Update missing inst


https://reviews.llvm.org/D23222

Files:
  include/llvm/Analysis/InlineCost.h
  lib/Analysis/InlineCost.cpp
  lib/Transforms/IPO/Inliner.cpp

Index: lib/Transforms/IPO/Inliner.cpp
===================================================================
--- lib/Transforms/IPO/Inliner.cpp
+++ lib/Transforms/IPO/Inliner.cpp
@@ -315,7 +315,7 @@
   // be removed entirely.  We did not account for this above unless there
   // is only one caller of Caller.
   if (callerWillBeRemoved && !Caller->use_empty())
-    TotalSecondaryCost += InlineConstants::LastCallToStaticBonus;
+    TotalSecondaryCost -= InlineConstants::LastCallToStaticBonus;
 
   if (inliningPreventsSomeOuterInline && TotalSecondaryCost < IC.getCost())
     return true;
Index: lib/Analysis/InlineCost.cpp
===================================================================
--- lib/Analysis/InlineCost.cpp
+++ lib/Analysis/InlineCost.cpp
@@ -1258,7 +1258,7 @@
   bool OnlyOneCallAndLocalLinkage =
       F.hasLocalLinkage() && F.hasOneUse() && &F == CS.getCalledFunction();
   if (OnlyOneCallAndLocalLinkage)
-    Cost += InlineConstants::LastCallToStaticBonus;
+    Cost -= InlineConstants::LastCallToStaticBonus;
 
   // If this function uses the coldcc calling convention, prefer not to inline
   // it.
Index: include/llvm/Analysis/InlineCost.h
===================================================================
--- include/llvm/Analysis/InlineCost.h
+++ include/llvm/Analysis/InlineCost.h
@@ -32,7 +32,7 @@
   const int InstrCost = 5;
   const int IndirectCallThreshold = 100;
   const int CallPenalty = 25;
-  const int LastCallToStaticBonus = -15000;
+  const int LastCallToStaticBonus = 15000;
   const int ColdccPenalty = 2000;
   const int NoreturnPenalty = 10000;
   /// Do not inline functions which allocate this many bytes on the stack


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23222.67012.patch
Type: text/x-patch
Size: 1670 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160805/0a102390/attachment-0001.bin>


More information about the llvm-commits mailing list