[llvm] 4ecc8fb - [CallSite removal][WebAssembly] Replace CallSite with CallBase in WebAssemblyOptimizeReturned.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 19 19:00:08 PDT 2020


Author: Craig Topper
Date: 2020-04-19T18:32:52-07:00
New Revision: 4ecc8fb7ebda3633fd855c0f50503e2b39d82d1c

URL: https://github.com/llvm/llvm-project/commit/4ecc8fb7ebda3633fd855c0f50503e2b39d82d1c
DIFF: https://github.com/llvm/llvm-project/commit/4ecc8fb7ebda3633fd855c0f50503e2b39d82d1c.diff

LOG: [CallSite removal][WebAssembly] Replace CallSite with CallBase in WebAssemblyOptimizeReturned.

Differential Revision: https://reviews.llvm.org/D78451

Added: 
    

Modified: 
    llvm/lib/Target/WebAssembly/WebAssemblyOptimizeReturned.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/WebAssembly/WebAssemblyOptimizeReturned.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyOptimizeReturned.cpp
index 9b60596e42b4..96390de8f5e7 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyOptimizeReturned.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyOptimizeReturned.cpp
@@ -42,7 +42,7 @@ class OptimizeReturned final : public FunctionPass,
   static char ID;
   OptimizeReturned() : FunctionPass(ID) {}
 
-  void visitCallSite(CallSite CS);
+  void visitCallBase(CallBase &CB);
 };
 } // End anonymous namespace
 
@@ -55,17 +55,16 @@ FunctionPass *llvm::createWebAssemblyOptimizeReturned() {
   return new OptimizeReturned();
 }
 
-void OptimizeReturned::visitCallSite(CallSite CS) {
-  for (unsigned I = 0, E = CS.getNumArgOperands(); I < E; ++I)
-    if (CS.paramHasAttr(I, Attribute::Returned)) {
-      Instruction *Inst = CS.getInstruction();
-      Value *Arg = CS.getArgOperand(I);
+void OptimizeReturned::visitCallBase(CallBase &CB) {
+  for (unsigned I = 0, E = CB.getNumArgOperands(); I < E; ++I)
+    if (CB.paramHasAttr(I, Attribute::Returned)) {
+      Value *Arg = CB.getArgOperand(I);
       // Ignore constants, globals, undef, etc.
       if (isa<Constant>(Arg))
         continue;
       // Like replaceDominatedUsesWith but using Instruction/Use dominance.
-      Arg->replaceUsesWithIf(Inst,
-                             [&](Use &U) { return DT->dominates(Inst, U); });
+      Arg->replaceUsesWithIf(&CB,
+                             [&](Use &U) { return DT->dominates(&CB, U); });
     }
 }
 


        


More information about the llvm-commits mailing list