[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
diff --git a/llvm/lib/Transforms/IPO/PartialInlining.cpp b/llvm/lib/Transforms/IPO/PartialInlining.cpp
index a172aad..733782e 100644
--- a/llvm/lib/Transforms/IPO/PartialInlining.cpp
+++ b/llvm/lib/Transforms/IPO/PartialInlining.cpp
@@ -775,9 +775,10 @@
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 @@
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 @@
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;
}