diff options
author | Easwaran Raman <eraman@google.com> | 2016-05-19 23:02:09 +0000 |
---|---|---|
committer | Easwaran Raman <eraman@google.com> | 2016-05-19 23:02:09 +0000 |
commit | bb578ef0dd7eebacebfb03a2e7bdfb3e3ba26b7e (patch) | |
tree | b1baa5cb617db2b052b1aada34d25ceea797067b /llvm/lib/Analysis/InlineCost.cpp | |
parent | ad940f23ee0911d6aac594aeed71f017bf1e89d7 (diff) | |
download | bcm5719-llvm-bb578ef0dd7eebacebfb03a2e7bdfb3e3ba26b7e.tar.gz bcm5719-llvm-bb578ef0dd7eebacebfb03a2e7bdfb3e3ba26b7e.zip |
Allow -inline-threshold to override default threshold.
Before r257832, the threshold used by SimpleInliner was explicitly specified or generated from opt levels and passed to the base class Inliner's constructor. There, it was first overridden by explicitly specified -inline-threshold. The refactoring in r257832 did not preserve this behavior for all opt levels. This change brings back the original behavior.
Differential Revision: http://reviews.llvm.org/D20452
llvm-svn: 270153
Diffstat (limited to 'llvm/lib/Analysis/InlineCost.cpp')
-rw-r--r-- | llvm/lib/Analysis/InlineCost.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index d3b2930d7ea..549d3a97ec0 100644 --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -612,11 +612,14 @@ void CallAnalyzer::updateThreshold(CallSite CS, Function &Callee) { return; } - // If -inline-threshold is not given, listen to the optsize and minsize - // attributes when they would decrease the threshold. Function *Caller = CS.getCaller(); - - if (!(DefaultInlineThreshold.getNumOccurrences() > 0)) { + if (DefaultInlineThreshold.getNumOccurrences() > 0) { + // Explicitly specified -inline-threhold overrides the threshold passed to + // CallAnalyzer's constructor. + Threshold = DefaultInlineThreshold; + } else { + // If -inline-threshold is not given, listen to the optsize and minsize + // attributes when they would decrease the threshold. if (Caller->optForMinSize() && OptMinSizeThreshold < Threshold) Threshold = OptMinSizeThreshold; else if (Caller->optForSize() && OptSizeThreshold < Threshold) |