summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2014-02-05 22:53:44 +0000
committerManman Ren <manman.ren@gmail.com>2014-02-05 22:53:44 +0000
commite8781b1a36eca8f611a6f7d06a0f5a0fd19fe238 (patch)
tree3b6fc1680785909c431c4f39c9028c17a0559f3e /llvm/lib/Transforms
parent4d6d981297d265341eef6ef6ff89dabfe8ca4a78 (diff)
downloadbcm5719-llvm-e8781b1a36eca8f611a6f7d06a0f5a0fd19fe238.tar.gz
bcm5719-llvm-e8781b1a36eca8f611a6f7d06a0f5a0fd19fe238.zip
Inliner uses a smaller inline threshold for callees with cold attribute.
Added command line option inlinecold-threshold to set threshold for inlining functions with cold attribute. Listen to the cold attribute when it would decrease the inline threshold. llvm-svn: 200886
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/Inliner.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp
index dc710d14157..8647f39a900 100644
--- a/llvm/lib/Transforms/IPO/Inliner.cpp
+++ b/llvm/lib/Transforms/IPO/Inliner.cpp
@@ -50,6 +50,10 @@ static cl::opt<int>
HintThreshold("inlinehint-threshold", cl::Hidden, cl::init(325),
cl::desc("Threshold for inlining functions with inline hint"));
+static cl::opt<int>
+ColdThreshold("inlinecold-threshold", cl::Hidden, cl::init(75),
+ cl::desc("Threshold for inlining functions with cold attribute"));
+
// Threshold to use when optsize is specified (and there is no -inline-limit).
const int OptSizeThreshold = 75;
@@ -277,6 +281,13 @@ unsigned Inliner::getInlineThreshold(CallSite CS) const {
Attribute::MinSize))
thres = HintThreshold;
+ // Listen to the cold attribute when it would decrease the threshold.
+ bool ColdCallee = Callee && !Callee->isDeclaration() &&
+ Callee->getAttributes().hasAttribute(AttributeSet::FunctionIndex,
+ Attribute::Cold);
+ if (ColdCallee && ColdThreshold < thres)
+ thres = ColdThreshold;
+
return thres;
}
OpenPOWER on IntegriCloud