From 7b6ff8bf1f8e2c4c860b15dea257eee8a109cc3e Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 15 Apr 2020 12:10:10 -0700 Subject: [PATCH] [CallSite removal][SampleProfile] Use CallBase instead of CallSite. NFC Differential Revision: https://reviews.llvm.org/D78219 --- llvm/lib/Transforms/IPO/SampleProfile.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp index 8777819..96886058 100644 --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -719,8 +719,7 @@ ErrorOr SampleProfileLoader::getInstWeight(const Instruction &Inst) { // it means that the inlined callsite has no sample, thus the call // instruction should have 0 count. if ((isa(Inst) || isa(Inst)) && - !ImmutableCallSite(&Inst).isIndirectCall() && - findCalleeFunctionSamples(Inst)) + !cast(Inst).isIndirectCall() && findCalleeFunctionSamples(Inst)) return 0; const DILocation *DIL = DLoc; @@ -933,7 +932,7 @@ bool SampleProfileLoader::shouldInlineColdCallee(Instruction &CallInst) { if (!ProfileSizeInline) return false; - Function *Callee = CallSite(&CallInst).getCalledFunction(); + Function *Callee = cast(CallInst).getCalledFunction(); if (Callee == nullptr) return false; @@ -948,7 +947,7 @@ void SampleProfileLoader::emitOptimizationRemarksForInlineCandidates( const SmallVector &Candidates, const Function &F, bool Hot) { for (auto I : Candidates) { - Function *CalledFunction = CallSite(I).getCalledFunction(); + Function *CalledFunction = cast(I)->getCalledFunction(); if (CalledFunction) { ORE->emit(OptimizationRemarkAnalysis(CSINLINE_DEBUG, "InlineAttempt", I->getDebugLoc(), I->getParent()) @@ -1019,11 +1018,11 @@ bool SampleProfileLoader::inlineHotFunctions( } } for (auto I : CIS) { - Function *CalledFunction = CallSite(I).getCalledFunction(); + Function *CalledFunction = cast(I)->getCalledFunction(); // Do not inline recursive calls. if (CalledFunction == &F) continue; - if (CallSite(I).isIndirectCall()) { + if (cast(I)->isIndirectCall()) { if (PromotedInsns.count(I)) continue; uint64_t Sum; @@ -1091,7 +1090,7 @@ bool SampleProfileLoader::inlineHotFunctions( // Accumulate not inlined callsite information into notInlinedSamples for (const auto &Pair : localNotInlinedCallSites) { Instruction *I = Pair.getFirst(); - Function *Callee = CallSite(I).getCalledFunction(); + Function *Callee = cast(I)->getCalledFunction(); if (!Callee || Callee->isDeclaration()) continue; @@ -1537,8 +1536,7 @@ void SampleProfileLoader::propagateWeights(Function &F) { for (auto &I : BB->getInstList()) { if (!isa(I) && !isa(I)) continue; - CallSite CS(&I); - if (!CS.getCalledFunction()) { + if (!cast(I).getCalledFunction()) { const DebugLoc &DLoc = I.getDebugLoc(); if (!DLoc) continue; -- 2.7.4