diff options
author | Devang Patel <dpatel@apple.com> | 2008-09-03 23:06:09 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2008-09-03 23:06:09 +0000 |
commit | a26e2075b87b3537da9482b4c8dbb69d2a509f29 (patch) | |
tree | dc00fe731633b921e1bb509742caafd6483cf684 | |
parent | 2fbfb7053025775272c82ec53a6658b927d63f65 (diff) | |
download | bcm5719-llvm-a26e2075b87b3537da9482b4c8dbb69d2a509f29.tar.gz bcm5719-llvm-a26e2075b87b3537da9482b4c8dbb69d2a509f29.zip |
Update inline threshold for current function if the notes say, optimize for size.
llvm-svn: 55745
-rw-r--r-- | llvm/lib/Transforms/IPO/Inliner.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index 1c3d5a81f36..38cb67dddf1 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/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 { |