From 7bbb4339f905345f92fcd60bf8f64bdc29c8cc36 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Wed, 3 Sep 2008 23:06:09 +0000 Subject: [PATCH] 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 --- lib/Transforms/IPO/Inliner.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp index 1c3d5a81f36..38cb67dddf1 100644 --- a/lib/Transforms/IPO/Inliner.cpp +++ b/lib/Transforms/IPO/Inliner.cpp @@ -139,8 +139,15 @@ bool Inliner::runOnSCC(const std::vector &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 { -- 2.34.1