Skip to content

Commit d89875c

Browse files
committed
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
1 parent c8b3717 commit d89875c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

llvm/include/llvm/Analysis/InlineCost.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const int OptAggressiveThreshold = 275;
4242
const int InstrCost = 5;
4343
const int IndirectCallThreshold = 100;
4444
const int CallPenalty = 25;
45-
const int LastCallToStaticBonus = -15000;
45+
const int LastCallToStaticBonus = 15000;
4646
const int ColdccPenalty = 2000;
4747
const int NoreturnPenalty = 10000;
4848
/// Do not inline functions which allocate this many bytes on the stack

llvm/lib/Analysis/InlineCost.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ bool CallAnalyzer::analyzeCall(CallSite CS) {
12571257
bool OnlyOneCallAndLocalLinkage =
12581258
F.hasLocalLinkage() && F.hasOneUse() && &F == CS.getCalledFunction();
12591259
if (OnlyOneCallAndLocalLinkage)
1260-
Cost += InlineConstants::LastCallToStaticBonus;
1260+
Cost -= InlineConstants::LastCallToStaticBonus;
12611261

12621262
// If this function uses the coldcc calling convention, prefer not to inline
12631263
// it.

llvm/lib/Transforms/IPO/Inliner.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ shouldBeDeferred(Function *Caller, CallSite CS, InlineCost IC,
312312
// be removed entirely. We did not account for this above unless there
313313
// is only one caller of Caller.
314314
if (callerWillBeRemoved && !Caller->use_empty())
315-
TotalSecondaryCost += InlineConstants::LastCallToStaticBonus;
315+
TotalSecondaryCost -= InlineConstants::LastCallToStaticBonus;
316316

317317
if (inliningPreventsSomeOuterInline && TotalSecondaryCost < IC.getCost())
318318
return true;

0 commit comments

Comments
 (0)