summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorEaswaran Raman <eraman@google.com>2016-08-10 00:48:04 +0000
committerEaswaran Raman <eraman@google.com>2016-08-10 00:48:04 +0000
commit1c57cc2b680a2d77bb63b554b7a7d832682e883f (patch)
tree4f2f18bcf5e3f37ca7bc4e2cc2af084076e3a33c /llvm/lib/Transforms
parent21db1ec221713f0be0a1de62acab96b24ea7e8a4 (diff)
downloadbcm5719-llvm-1c57cc2b680a2d77bb63b554b7a7d832682e883f.tar.gz
bcm5719-llvm-1c57cc2b680a2d77bb63b554b7a7d832682e883f.zip
Do not directly use inline threshold cl options in cost analysis.
This adds an InlineParams struct which is populated from the command line options by getInlineParams and passed to getInlineCost for the call analyzer to use. Differential revision: https://reviews.llvm.org/D22120 llvm-svn: 278189
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/InlineSimple.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/IPO/InlineSimple.cpp b/llvm/lib/Transforms/IPO/InlineSimple.cpp
index 8131683abd0..d135ccff520 100644
--- a/llvm/lib/Transforms/IPO/InlineSimple.cpp
+++ b/llvm/lib/Transforms/IPO/InlineSimple.cpp
@@ -39,20 +39,15 @@ namespace {
/// inliner pass and the always inliner pass. The two passes use different cost
/// analyses to determine when to inline.
class SimpleInliner : public Inliner {
- // This field is populated based on one of the following:
- // * optimization or size-optimization levels,
- // * the --inline-threshold flag, or
- // * a user specified value.
- int DefaultThreshold;
+
+ InlineParams Params;
public:
- SimpleInliner()
- : Inliner(ID), DefaultThreshold(llvm::getDefaultInlineThreshold()) {
+ SimpleInliner() : Inliner(ID), Params(llvm::getInlineParams()) {
initializeSimpleInlinerPass(*PassRegistry::getPassRegistry());
}
- explicit SimpleInliner(int Threshold)
- : Inliner(ID), DefaultThreshold(Threshold) {
+ explicit SimpleInliner(InlineParams Params) : Inliner(ID), Params(Params) {
initializeSimpleInlinerPass(*PassRegistry::getPassRegistry());
}
@@ -65,8 +60,7 @@ public:
[&](Function &F) -> AssumptionCache & {
return ACT->getAssumptionCache(F);
};
- return llvm::getInlineCost(CS, DefaultThreshold, TTI, GetAssumptionCache,
- PSI);
+ return llvm::getInlineCost(CS, Params, TTI, GetAssumptionCache, PSI);
}
bool runOnSCC(CallGraphSCC &SCC) override;
@@ -74,6 +68,7 @@ public:
private:
TargetTransformInfoWrapperPass *TTIWP;
+
};
} // end anonymous namespace
@@ -92,13 +87,12 @@ INITIALIZE_PASS_END(SimpleInliner, "inline", "Function Integration/Inlining",
Pass *llvm::createFunctionInliningPass() { return new SimpleInliner(); }
Pass *llvm::createFunctionInliningPass(int Threshold) {
- return new SimpleInliner(Threshold);
+ return new SimpleInliner(llvm::getInlineParams(Threshold));
}
Pass *llvm::createFunctionInliningPass(unsigned OptLevel,
unsigned SizeOptLevel) {
- return new SimpleInliner(
- llvm::computeThresholdFromOptLevels(OptLevel, SizeOptLevel));
+ return new SimpleInliner(llvm::getInlineParams(OptLevel, SizeOptLevel));
}
bool SimpleInliner::runOnSCC(CallGraphSCC &SCC) {
OpenPOWER on IntegriCloud