diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyOptimizeReturned.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyOptimizeReturned.cpp --- a/llvm/lib/Target/WebAssembly/WebAssemblyOptimizeReturned.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyOptimizeReturned.cpp @@ -42,7 +42,7 @@ static char ID; OptimizeReturned() : FunctionPass(ID) {} - void visitCallSite(CallSite CS); + void visitCallBase(CallBase &CB); }; } // End anonymous namespace @@ -55,17 +55,16 @@ 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(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); }); } }