diff options
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r-- | lib/Transforms/IPO/InlineAlways.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/IPO/InlineSimple.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/IPO/Inliner.cpp | 15 |
3 files changed, 16 insertions, 3 deletions
diff --git a/lib/Transforms/IPO/InlineAlways.cpp b/lib/Transforms/IPO/InlineAlways.cpp index 2799d6b..d809b5a 100644 --- a/lib/Transforms/IPO/InlineAlways.cpp +++ b/lib/Transforms/IPO/InlineAlways.cpp @@ -39,7 +39,7 @@ namespace { // Use extremely low threshold. AlwaysInliner() : Inliner(&ID, -2000000000) {} static char ID; // Pass identification, replacement for typeid - int getInlineCost(CallSite CS) { + InlineCost getInlineCost(CallSite CS) { return CA.getInlineCost(CS, NeverInline); } float getInlineFudgeFactor(CallSite CS) { diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp index 02cae2a..8ae5235 100644 --- a/lib/Transforms/IPO/InlineSimple.cpp +++ b/lib/Transforms/IPO/InlineSimple.cpp @@ -37,7 +37,7 @@ namespace { SimpleInliner() : Inliner(&ID) {} SimpleInliner(int Threshold) : Inliner(&ID, Threshold) {} static char ID; // Pass identification, replacement for typeid - int getInlineCost(CallSite CS) { + InlineCost getInlineCost(CallSite CS) { return CA.getInlineCost(CS, NeverInline); } float getInlineFudgeFactor(CallSite CS) { diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp index 74af183..2321047 100644 --- a/lib/Transforms/IPO/Inliner.cpp +++ b/lib/Transforms/IPO/Inliner.cpp @@ -76,9 +76,22 @@ static bool InlineCallIfPossible(CallSite CS, CallGraph &CG, /// shouldInline - Return true if the inliner should attempt to inline /// at the given CallSite. bool Inliner::shouldInline(CallSite CS) { - int Cost = getInlineCost(CS); + InlineCost IC = getInlineCost(CS); float FudgeFactor = getInlineFudgeFactor(CS); + if (IC.isAlways()) { + DOUT << " Inlining: cost=always" + << ", Call: " << *CS.getInstruction(); + return true; + } + + if (IC.isNever()) { + DOUT << " NOT Inlining: cost=never" + << ", Call: " << *CS.getInstruction(); + return false; + } + + int Cost = IC.getValue(); int CurrentThreshold = InlineThreshold; Function *Fn = CS.getCaller(); if (Fn && !Fn->isDeclaration() |