[llvm] r354542 - [Inliner] Pass nullptr for the ORE param of getInlineCost if RemarkEnabled
Wei Mi via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 20 18:57:52 PST 2019
Author: wmi
Date: Wed Feb 20 18:57:52 2019
New Revision: 354542
URL: http://llvm.org/viewvc/llvm-project?rev=354542&view=rev
Log:
[Inliner] Pass nullptr for the ORE param of getInlineCost if RemarkEnabled
is false.
Right now for inliner and partial inliner, we always pass the address of a
valid ORE object to getInlineCost even if RemarkEnabled is false because of
no -Rpass is specified. Since ComputeFullInlineCost will be set to true if
ORE is non-null in getInlineCost, this introduces the problem that in
getInlineCost we cannot return early even if we already know the cost is
definitely higher than the threshold. It is a general problem for compile
time.
This patch fixes that by pass nullptr as the ORE argument if RemarkEnabled is
false.
Differential Revision: https://reviews.llvm.org/D58399
Modified:
llvm/trunk/lib/Transforms/IPO/Inliner.cpp
llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp
Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=354542&r1=354541&r2=354542&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Wed Feb 20 18:57:52 2019
@@ -1005,8 +1005,11 @@ PreservedAnalyses InlinerPass::run(LazyC
auto GetInlineCost = [&](CallSite CS) {
Function &Callee = *CS.getCalledFunction();
auto &CalleeTTI = FAM.getResult<TargetIRAnalysis>(Callee);
+ bool RemarksEnabled =
+ Callee.getContext().getDiagHandlerPtr()->isMissedOptRemarkEnabled(
+ DEBUG_TYPE);
return getInlineCost(CS, Params, CalleeTTI, GetAssumptionCache, {GetBFI},
- PSI, &ORE);
+ PSI, RemarksEnabled ? &ORE : nullptr);
};
// Now process as many calls as we have within this caller in the sequnece.
Modified: llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp?rev=354542&r1=354541&r2=354542&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp Wed Feb 20 18:57:52 2019
@@ -772,8 +772,12 @@ bool PartialInlinerImpl::shouldPartialIn
Function *Caller = CS.getCaller();
auto &CalleeTTI = (*GetTTI)(*Callee);
- InlineCost IC = getInlineCost(CS, getInlineParams(), CalleeTTI,
- *GetAssumptionCache, GetBFI, PSI, &ORE);
+ bool RemarksEnabled =
+ Callee->getContext().getDiagHandlerPtr()->isMissedOptRemarkEnabled(
+ DEBUG_TYPE);
+ InlineCost IC =
+ getInlineCost(CS, getInlineParams(), CalleeTTI, *GetAssumptionCache,
+ GetBFI, PSI, RemarksEnabled ? &ORE : nullptr);
if (IC.isAlways()) {
ORE.emit([&]() {
More information about the llvm-commits
mailing list