[PATCH] D23222: Changed sign of LastCallToStaticBouns

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


Prazek created this revision.
Prazek added reviewers: eraman, tejohnson, mehdi_amini.
Prazek added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.

I think it is much better this way.
When I firstly saw line:
  Cost += InlineConstants::LastCallToStaticBonus;
I though that this is a bug, because everywhere where the cost is being reduced
it is usuing -=.

https://reviews.llvm.org/D23222

Files:
  include/llvm/Analysis/InlineCost.h
  lib/Analysis/InlineCost.cpp

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.67006.patch
Type: text/x-patch
Size: 1080 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160805/e85a185b/attachment.bin>


More information about the llvm-commits mailing list