diff options
author | Fedor Sergeev <fedor.sergeev@azul.com> | 2019-04-23 12:43:27 +0000 |
---|---|---|
committer | Fedor Sergeev <fedor.sergeev@azul.com> | 2019-04-23 12:43:27 +0000 |
commit | 652168a99b5cdc1fb420b1224c8c2d42ad2b7465 (patch) | |
tree | 2cb15f62b733e35ca86dcb6c9158a59dde42ee3b /llvm/lib/Transforms | |
parent | ccba42c7eb3cdfe7824cd4b473a9688e5738fa3a (diff) | |
download | bcm5719-llvm-652168a99b5cdc1fb420b1224c8c2d42ad2b7465.tar.gz bcm5719-llvm-652168a99b5cdc1fb420b1224c8c2d42ad2b7465.zip |
[CallSite removal] move InlineCost to CallBase usage
Converting InlineCost interface and its internals into CallBase usage.
Inliners themselves are still not converted.
Reviewed By: reames
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60636
llvm-svn: 358982
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/InlineSimple.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/Inliner.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/PartialInlining.cpp | 13 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/SampleProfile.cpp | 5 |
4 files changed, 16 insertions, 13 deletions
diff --git a/llvm/lib/Transforms/IPO/InlineSimple.cpp b/llvm/lib/Transforms/IPO/InlineSimple.cpp index c9ce14f2892..efb71b73cbb 100644 --- a/llvm/lib/Transforms/IPO/InlineSimple.cpp +++ b/llvm/lib/Transforms/IPO/InlineSimple.cpp @@ -68,9 +68,9 @@ public: [&](Function &F) -> AssumptionCache & { return ACT->getAssumptionCache(F); }; - return llvm::getInlineCost(CS, Params, TTI, GetAssumptionCache, - /*GetBFI=*/None, PSI, - RemarksEnabled ? &ORE : nullptr); + return llvm::getInlineCost( + cast<CallBase>(*CS.getInstruction()), Params, TTI, GetAssumptionCache, + /*GetBFI=*/None, PSI, RemarksEnabled ? &ORE : nullptr); } bool runOnSCC(CallGraphSCC &SCC) override; diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index f6e8b5344f5..945f8affae6 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -1008,8 +1008,9 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC, bool RemarksEnabled = Callee.getContext().getDiagHandlerPtr()->isMissedOptRemarkEnabled( DEBUG_TYPE); - return getInlineCost(CS, Params, CalleeTTI, GetAssumptionCache, {GetBFI}, - PSI, RemarksEnabled ? &ORE : nullptr); + return getInlineCost(cast<CallBase>(*CS.getInstruction()), Params, + CalleeTTI, GetAssumptionCache, {GetBFI}, PSI, + RemarksEnabled ? &ORE : nullptr); }; // Now process as many calls as we have within this caller in the sequnece. diff --git a/llvm/lib/Transforms/IPO/PartialInlining.cpp b/llvm/lib/Transforms/IPO/PartialInlining.cpp index a172aadaea0..733782e8764 100644 --- a/llvm/lib/Transforms/IPO/PartialInlining.cpp +++ b/llvm/lib/Transforms/IPO/PartialInlining.cpp @@ -775,9 +775,10 @@ bool PartialInlinerImpl::shouldPartialInline( bool RemarksEnabled = Callee->getContext().getDiagHandlerPtr()->isMissedOptRemarkEnabled( DEBUG_TYPE); - InlineCost IC = - getInlineCost(CS, getInlineParams(), CalleeTTI, *GetAssumptionCache, - GetBFI, PSI, RemarksEnabled ? &ORE : nullptr); + assert(Call && "invalid callsite for partial inline"); + InlineCost IC = getInlineCost(cast<CallBase>(*Call), getInlineParams(), + CalleeTTI, *GetAssumptionCache, GetBFI, PSI, + RemarksEnabled ? &ORE : nullptr); if (IC.isAlways()) { ORE.emit([&]() { @@ -811,7 +812,7 @@ bool PartialInlinerImpl::shouldPartialInline( const DataLayout &DL = Caller->getParent()->getDataLayout(); // The savings of eliminating the call: - int NonWeightedSavings = getCallsiteCost(CS, DL); + int NonWeightedSavings = getCallsiteCost(cast<CallBase>(*Call), DL); BlockFrequency NormWeightedSavings(NonWeightedSavings); // Weighted saving is smaller than weighted cost, return false @@ -868,12 +869,12 @@ int PartialInlinerImpl::computeBBInlineCost(BasicBlock *BB) { continue; if (CallInst *CI = dyn_cast<CallInst>(&I)) { - InlineCost += getCallsiteCost(CallSite(CI), DL); + InlineCost += getCallsiteCost(*CI, DL); continue; } if (InvokeInst *II = dyn_cast<InvokeInst>(&I)) { - InlineCost += getCallsiteCost(CallSite(II), DL); + InlineCost += getCallsiteCost(*II, DL); continue; } diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp index 2955c338e91..877d20e72ff 100644 --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -752,8 +752,9 @@ bool SampleProfileLoader::inlineCallInstruction(Instruction *I) { // when cost exceeds threshold without checking all IRs in the callee. // The acutal cost does not matter because we only checks isNever() to // see if it is legal to inline the callsite. - InlineCost Cost = getInlineCost(CS, Params, GetTTI(*CalledFunction), GetAC, - None, nullptr, nullptr); + InlineCost Cost = + getInlineCost(cast<CallBase>(*I), Params, GetTTI(*CalledFunction), GetAC, + None, nullptr, nullptr); if (Cost.isNever()) { ORE->emit(OptimizationRemark(DEBUG_TYPE, "Not inline", DLoc, BB) << "incompatible inlining"); |