summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2017-08-25 22:01:42 +0000
committerDavide Italiano <davide@freebsd.org>2017-08-25 22:01:42 +0000
commita872519dbd9fe92243263ee2fb4179cae2498cb2 (patch)
treef8c65dd60b9c2ba2e4651822f691816324ee57f2 /llvm/lib
parent6ec7595b1e2ab79a1b456fe3338cce9619a08083 (diff)
downloadbcm5719-llvm-a872519dbd9fe92243263ee2fb4179cae2498cb2.tar.gz
bcm5719-llvm-a872519dbd9fe92243263ee2fb4179cae2498cb2.zip
[Inliner] Only compute fully inline cost when remarks are enabled.
Prior to this change (and after r311371), we computed it unconditionally, causin gsevere compile time regressions (in some cases, 5 to 10x). llvm-svn: 311804
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/IPO/InlineSimple.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/InlineSimple.cpp b/llvm/lib/Transforms/IPO/InlineSimple.cpp
index 1af40d3dab8..b7a7979bb56 100644
--- a/llvm/lib/Transforms/IPO/InlineSimple.cpp
+++ b/llvm/lib/Transforms/IPO/InlineSimple.cpp
@@ -57,13 +57,23 @@ public:
InlineCost getInlineCost(CallSite CS) override {
Function *Callee = CS.getCalledFunction();
TargetTransformInfo &TTI = TTIWP->getTTI(*Callee);
+
+ bool RemarksEnabled = false;
+ const auto &BBs = CS.getCaller()->getBasicBlockList();
+ if (!BBs.empty()) {
+ auto DI = OptimizationRemark(DEBUG_TYPE, "", DebugLoc(), &BBs.front());
+ if (DI.isEnabled())
+ RemarksEnabled = true;
+ }
OptimizationRemarkEmitter ORE(CS.getCaller());
+
std::function<AssumptionCache &(Function &)> GetAssumptionCache =
[&](Function &F) -> AssumptionCache & {
return ACT->getAssumptionCache(F);
};
return llvm::getInlineCost(CS, Params, TTI, GetAssumptionCache,
- /*GetBFI=*/None, PSI, &ORE);
+ /*GetBFI=*/None, PSI,
+ RemarksEnabled ? &ORE : nullptr);
}
bool runOnSCC(CallGraphSCC &SCC) override;
OpenPOWER on IntegriCloud