summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-09-03 23:06:09 +0000
committerDevang Patel <dpatel@apple.com>2008-09-03 23:06:09 +0000
commit7bbb4339f905345f92fcd60bf8f64bdc29c8cc36 (patch)
tree149228cc52f25cb3044e42fd8b3106ac4d4e3829 /lib/Transforms
parent0c7f91cf843247a34ae9147af0708d238d43f9f9 (diff)
downloadllvm-7bbb4339f905345f92fcd60bf8f64bdc29c8cc36.tar.gz
llvm-7bbb4339f905345f92fcd60bf8f64bdc29c8cc36.tar.bz2
llvm-7bbb4339f905345f92fcd60bf8f64bdc29c8cc36.tar.xz
Update inline threshold for current function if the notes say, optimize for size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55745 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-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 {