summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/IPO/Inliner.cpp
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-01-23 11:09:33 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-01-23 11:09:33 +0000
commit3fd58f91dd318518f7daa4ba64c0aaf31799d89b (patch)
tree74eecbae571601ec6a626a53374b1eddc7b164a5 /lib/Transforms/IPO/Inliner.cpp
parent3fba7d16b41dfbefe3b1be6bc0ab94c017728f79 (diff)
downloadFreeBSD-src-3fd58f91dd318518f7daa4ba64c0aaf31799d89b.zip
FreeBSD-src-3fd58f91dd318518f7daa4ba64c0aaf31799d89b.tar.gz
Update LLVM to r94309.
Diffstat (limited to 'lib/Transforms/IPO/Inliner.cpp')
-rw-r--r--lib/Transforms/IPO/Inliner.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp
index 5725db1..0990278 100644
--- a/lib/Transforms/IPO/Inliner.cpp
+++ b/lib/Transforms/IPO/Inliner.cpp
@@ -171,7 +171,16 @@ static bool InlineCallIfPossible(CallSite CS, CallGraph &CG,
return true;
}
-
+
+unsigned Inliner::getInlineThreshold(Function* Caller) const {
+ if (Caller && !Caller->isDeclaration() &&
+ Caller->hasFnAttr(Attribute::OptimizeForSize) &&
+ InlineLimit.getNumOccurrences() == 0)
+ return 50;
+ else
+ return InlineThreshold;
+}
+
/// shouldInline - Return true if the inliner should attempt to inline
/// at the given CallSite.
bool Inliner::shouldInline(CallSite CS) {
@@ -190,14 +199,8 @@ bool Inliner::shouldInline(CallSite CS) {
}
int Cost = IC.getValue();
- int CurrentThreshold = InlineThreshold;
Function *Caller = CS.getCaller();
- if (Caller && !Caller->isDeclaration() &&
- Caller->hasFnAttr(Attribute::OptimizeForSize) &&
- InlineLimit.getNumOccurrences() == 0 &&
- InlineThreshold != 50)
- CurrentThreshold = 50;
-
+ int CurrentThreshold = getInlineThreshold(Caller);
float FudgeFactor = getInlineFudgeFactor(CS);
if (Cost >= (int)(CurrentThreshold * FudgeFactor)) {
DEBUG(dbgs() << " NOT Inlining: cost=" << Cost
@@ -233,13 +236,8 @@ bool Inliner::shouldInline(CallSite CS) {
outerCallsFound = true;
int Cost2 = IC2.getValue();
- int CurrentThreshold2 = InlineThreshold;
Function *Caller2 = CS2.getCaller();
- if (Caller2 && !Caller2->isDeclaration() &&
- Caller2->hasFnAttr(Attribute::OptimizeForSize) &&
- InlineThreshold != 50)
- CurrentThreshold2 = 50;
-
+ int CurrentThreshold2 = getInlineThreshold(Caller2);
float FudgeFactor2 = getInlineFudgeFactor(CS2);
if (Cost2 >= (int)(CurrentThreshold2 * FudgeFactor2))
OpenPOWER on IntegriCloud