summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/Inliner.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-10-09 21:42:02 +0000
committerDale Johannesen <dalej@apple.com>2009-10-09 21:42:02 +0000
commitbdb984bc2757114bc706026603ed40d7f508c4c1 (patch)
treefd2e8b0e174e61730ca54aa4ac0621fd8aa1132c /lib/Transforms/IPO/Inliner.cpp
parentd7894f105a3c397a3d7f5c5136eee39f5865e64b (diff)
downloadllvm-bdb984bc2757114bc706026603ed40d7f508c4c1.tar.gz
llvm-bdb984bc2757114bc706026603ed40d7f508c4c1.tar.bz2
llvm-bdb984bc2757114bc706026603ed40d7f508c4c1.tar.xz
Use names instead of numbers for some of the magic
constants used in inlining heuristics (especially those used in more than one file). No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83675 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/Inliner.cpp')
-rw-r--r--lib/Transforms/IPO/Inliner.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp
index 7b512d60d9..1780480cd9 100644
--- a/lib/Transforms/IPO/Inliner.cpp
+++ b/lib/Transforms/IPO/Inliner.cpp
@@ -243,10 +243,11 @@ bool Inliner::shouldInline(CallSite CS) {
if (Cost2 >= (int)(CurrentThreshold2 * FudgeFactor2))
allOuterCallsWillBeInlined = false;
- // See if we have this case. The magic 6 is what InlineCost assigns
+ // See if we have this case. We subtract off the penalty
// for the call instruction, which we would be deleting.
if (Cost2 < (int)(CurrentThreshold2 * FudgeFactor2) &&
- Cost2 + Cost - 6 >= (int)(CurrentThreshold2 * FudgeFactor2)) {
+ Cost2 + Cost - (InlineConstants::CallPenalty + 1) >=
+ (int)(CurrentThreshold2 * FudgeFactor2)) {
someOuterCallWouldNotBeInlined = true;
TotalSecondaryCost += Cost2;
}
@@ -256,7 +257,7 @@ bool Inliner::shouldInline(CallSite CS) {
// be removed entirely. We did not account for this above unless there
// is only one caller of Caller.
if (allOuterCallsWillBeInlined && Caller->use_begin() != Caller->use_end())
- TotalSecondaryCost -= 15000;
+ TotalSecondaryCost += InlineConstants::LastCallToStaticBonus;
if (outerCallsFound && someOuterCallWouldNotBeInlined &&
TotalSecondaryCost < Cost) {