diff options
| author | Justin Lebar <jlebar@google.com> | 2016-04-15 01:38:48 +0000 |
|---|---|---|
| committer | Justin Lebar <jlebar@google.com> | 2016-04-15 01:38:48 +0000 |
| commit | 8650a4da93344eb7ed2342a46b2808f44f206507 (patch) | |
| tree | d07e0009f3cb7b0f002cc7c803aa88757dcdbeb3 /llvm/lib | |
| parent | 7dba2e0d0ca2bb0fec1e8c9a3f718e580a9501cb (diff) | |
| download | bcm5719-llvm-8650a4da93344eb7ed2342a46b2808f44f206507.tar.gz bcm5719-llvm-8650a4da93344eb7ed2342a46b2808f44f206507.zip | |
[TTI] Add getInliningThresholdMultiplier.
Summary:
InlineCost's threshold is multiplied by this value. This lets us adjust
the inlining threshold up or down on a per-target basis. For example,
we might want to increase the threshold on targets where calls are
unusually expensive.
Reviewers: chandlerc
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D18560
llvm-svn: 266405
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/InlineCost.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/Analysis/TargetTransformInfo.cpp | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index c3df122fd0a..aa46b68d8c3 100644 --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -655,6 +655,10 @@ void CallAnalyzer::updateThreshold(CallSite CS, Function &Callee) { ColdThreshold.getNumOccurrences() > 0) && ColdCallee && ColdThreshold < Threshold) Threshold = ColdThreshold; + + // Finally, take the target-specific inlining threshold multiplier into + // account. + Threshold *= TTI.getInliningThresholdMultiplier(); } bool CallAnalyzer::visitCmpInst(CmpInst &I) { diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp index 9b23d7ca932..c8f116a1d33 100644 --- a/llvm/lib/Analysis/TargetTransformInfo.cpp +++ b/llvm/lib/Analysis/TargetTransformInfo.cpp @@ -66,6 +66,10 @@ int TargetTransformInfo::getCallCost(const Function *F, return Cost; } +unsigned TargetTransformInfo::getInliningThresholdMultiplier() const { + return TTIImpl->getInliningThresholdMultiplier(); +} + int TargetTransformInfo::getIntrinsicCost( Intrinsic::ID IID, Type *RetTy, ArrayRef<const Value *> Arguments) const { int Cost = TTIImpl->getIntrinsicCost(IID, RetTy, Arguments); |

