summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2014-04-25 17:34:55 +0000
committerManman Ren <manman.ren@gmail.com>2014-04-25 17:34:55 +0000
commit3bd471dee21692993e4031d0d195af33e94fd56e (patch)
tree98eafa356b7bd3aba6b0e5219bc679c876c1164b /lib/Transforms/IPO
parent7d772dda4e228b4034c300c2c2955e14f0f89885 (diff)
downloadllvm-3bd471dee21692993e4031d0d195af33e94fd56e.tar.gz
llvm-3bd471dee21692993e4031d0d195af33e94fd56e.tar.bz2
llvm-3bd471dee21692993e4031d0d195af33e94fd56e.tar.xz
[inline cold threshold] Command line argument for inline threshold will
override the default cold threshold. When we use command line argument to set the inline threshold, the default cold threshold will not be used. This is in line with how we use OptSizeThreshold. When we want a higher threshold for all functions, we do not have to set both inline threshold and cold threshold. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207245 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/Inliner.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp
index e6748c4698..10b20cfc91 100644
--- a/lib/Transforms/IPO/Inliner.cpp
+++ b/lib/Transforms/IPO/Inliner.cpp
@@ -290,7 +290,12 @@ unsigned Inliner::getInlineThreshold(CallSite CS) const {
bool ColdCallee = Callee && !Callee->isDeclaration() &&
Callee->getAttributes().hasAttribute(AttributeSet::FunctionIndex,
Attribute::Cold);
- if (ColdCallee && ColdThreshold < thres)
+ // Command line argument for InlineLimit will override the default
+ // ColdThreshold. If we have -inline-threshold but no -inlinecold-threshold,
+ // do not use the default cold threshold even if it is smaller.
+ if ((InlineLimit.getNumOccurrences() == 0 ||
+ ColdThreshold.getNumOccurrences() > 0) && ColdCallee &&
+ ColdThreshold < thres)
thres = ColdThreshold;
return thres;