[PATCH] D78219: [CallSite removal][SampleProfile] Use CallBase instead of CallSite. NFC

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 11:30:31 PDT 2020


craig.topper created this revision.
craig.topper added reviewers: mtrofin, dblaikie.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78219

Files:
  llvm/lib/Transforms/IPO/SampleProfile.cpp


Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -719,8 +719,7 @@
   // it means that the inlined callsite has no sample, thus the call
   // instruction should have 0 count.
   if ((isa<CallInst>(Inst) || isa<InvokeInst>(Inst)) &&
-      !ImmutableCallSite(&Inst).isIndirectCall() &&
-      findCalleeFunctionSamples(Inst))
+      !cast<CallBase>(Inst).isIndirectCall() && findCalleeFunctionSamples(Inst))
     return 0;
 
   const DILocation *DIL = DLoc;
@@ -933,7 +932,7 @@
   if (!ProfileSizeInline)
     return false;
 
-  Function *Callee = CallSite(&CallInst).getCalledFunction();
+  Function *Callee = cast<CallBase>(CallInst).getCalledFunction();
   if (Callee == nullptr)
     return false;
 
@@ -948,7 +947,7 @@
     const SmallVector<Instruction *, 10> &Candidates, const Function &F,
     bool Hot) {
   for (auto I : Candidates) {
-    Function *CalledFunction = CallSite(I).getCalledFunction();
+    Function *CalledFunction = cast<CallBase>(I)->getCalledFunction();
     if (CalledFunction) {
       ORE->emit(OptimizationRemarkAnalysis(CSINLINE_DEBUG, "InlineAttempt", 
                                            I->getDebugLoc(), I->getParent())
@@ -1019,11 +1018,11 @@
       }
     }
     for (auto I : CIS) {
-      Function *CalledFunction = CallSite(I).getCalledFunction();
+      Function *CalledFunction = cast<CallBase>(I)->getCalledFunction();
       // Do not inline recursive calls.
       if (CalledFunction == &F)
         continue;
-      if (CallSite(I).isIndirectCall()) {
+      if (cast<CallBase>(I)->isIndirectCall()) {
         if (PromotedInsns.count(I))
           continue;
         uint64_t Sum;
@@ -1091,7 +1090,7 @@
   // Accumulate not inlined callsite information into notInlinedSamples
   for (const auto &Pair : localNotInlinedCallSites) {
     Instruction *I = Pair.getFirst();
-    Function *Callee = CallSite(I).getCalledFunction();
+    Function *Callee = cast<CallBase>(I)->getCalledFunction();
     if (!Callee || Callee->isDeclaration())
       continue;
 
@@ -1537,8 +1536,7 @@
       for (auto &I : BB->getInstList()) {
         if (!isa<CallInst>(I) && !isa<InvokeInst>(I))
           continue;
-        CallSite CS(&I);
-        if (!CS.getCalledFunction()) {
+        if (!cast<CallBase>(I).getCalledFunction()) {
           const DebugLoc &DLoc = I.getDebugLoc();
           if (!DLoc)
             continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78219.257762.patch
Type: text/x-patch
Size: 2534 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200415/dd0b036e/attachment-0001.bin>


More information about the llvm-commits mailing list