summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Transforms/IPO/Inliner.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp
index 1c3d5a81f3..38cb67dddf 100644
--- a/lib/Transforms/IPO/Inliner.cpp
+++ b/lib/Transforms/IPO/Inliner.cpp
@@ -139,8 +139,15 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) {
CallSite CS = CallSites[CSi];
int InlineCost = getInlineCost(CS);
float FudgeFactor = getInlineFudgeFactor(CS);
-
- if (InlineCost >= (int)(InlineThreshold * FudgeFactor)) {
+
+ int CurrentThreshold = InlineThreshold;
+ Function *Fn = CS.getCaller();
+ if (Fn && (Fn->getNotes() & FN_NOTE_OptimizeForSize)
+ && InlineThreshold != 50) {
+ CurrentThreshold = 50;
+ }
+
+ if (InlineCost >= (int)(CurrentThreshold * FudgeFactor)) {
DOUT << " NOT Inlining: cost=" << InlineCost
<< ", Call: " << *CS.getInstruction();
} else {