diff options
| author | Piotr Padlewski <piotr.padlewski@gmail.com> | 2016-08-10 21:15:22 +0000 | 
|---|---|---|
| committer | Piotr Padlewski <piotr.padlewski@gmail.com> | 2016-08-10 21:15:22 +0000 | 
| commit | d89875ca39f98e6df5a331b8c43eaa982822f0c4 (patch) | |
| tree | a049afe266ab5f6c993be1e43af9937fb54696e9 | |
| parent | c8b371734445cf1c5c19077580c3529998364d3e (diff) | |
| download | bcm5719-llvm-d89875ca39f98e6df5a331b8c43eaa982822f0c4.tar.gz bcm5719-llvm-d89875ca39f98e6df5a331b8c43eaa982822f0c4.zip | |
Changed sign of LastCallToStaticBouns
Summary:
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 -=.
Reviewers: eraman, tejohnson, mehdi_amini
Subscribers: llvm-commits, mehdi_amini
Differential Revision: https://reviews.llvm.org/D23222
llvm-svn: 278290
| -rw-r--r-- | llvm/include/llvm/Analysis/InlineCost.h | 2 | ||||
| -rw-r--r-- | llvm/lib/Analysis/InlineCost.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/Transforms/IPO/Inliner.cpp | 2 | 
3 files changed, 3 insertions, 3 deletions
| diff --git a/llvm/include/llvm/Analysis/InlineCost.h b/llvm/include/llvm/Analysis/InlineCost.h index b40973356ac..6b7adcc45ef 100644 --- a/llvm/include/llvm/Analysis/InlineCost.h +++ b/llvm/include/llvm/Analysis/InlineCost.h @@ -42,7 +42,7 @@ const int OptAggressiveThreshold = 275;  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 diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index dd9174c0bcd..c0ac6c86ce9 100644 --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -1257,7 +1257,7 @@ bool CallAnalyzer::analyzeCall(CallSite CS) {    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. diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index c814b01750d..ab274878110 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -312,7 +312,7 @@ shouldBeDeferred(Function *Caller, CallSite CS, InlineCost IC,    // 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; | 

