[llvm] r311804 - [Inliner] Only compute fully inline cost when remarks are enabled.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 25 15:01:42 PDT 2017
Author: davide
Date: Fri Aug 25 15:01:42 2017
New Revision: 311804
URL: http://llvm.org/viewvc/llvm-project?rev=311804&view=rev
Log:
[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).
Modified:
llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp
Modified: llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp?rev=311804&r1=311803&r2=311804&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp Fri Aug 25 15:01:42 2017
@@ -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;
More information about the llvm-commits
mailing list