From 652168a99b5cdc1fb420b1224c8c2d42ad2b7465 Mon Sep 17 00:00:00 2001 From: Fedor Sergeev Date: Tue, 23 Apr 2019 12:43:27 +0000 Subject: [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 --- llvm/lib/Transforms/IPO/PartialInlining.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Transforms/IPO/PartialInlining.cpp') 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(*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(*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(&I)) { - InlineCost += getCallsiteCost(CallSite(CI), DL); + InlineCost += getCallsiteCost(*CI, DL); continue; } if (InvokeInst *II = dyn_cast(&I)) { - InlineCost += getCallsiteCost(CallSite(II), DL); + InlineCost += getCallsiteCost(*II, DL); continue; } -- cgit v1.2.3