diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h index 8d11643da03a0b..e988eecfefbbed 100644 --- a/llvm/include/llvm/IR/IRBuilder.h +++ b/llvm/include/llvm/IR/IRBuilder.h @@ -814,7 +814,7 @@ class IRBuilderBase { /// start a new statepoint sequence. CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes, Value *ActualCallee, uint32_t Flags, - ArrayRef CallArgs, + ArrayRef CallArgs, Optional> TransitionArgs, Optional> DeoptArgs, ArrayRef GCArgs, @@ -843,7 +843,7 @@ class IRBuilderBase { InvokeInst *CreateGCStatepointInvoke( uint64_t ID, uint32_t NumPatchBytes, Value *ActualInvokee, BasicBlock *NormalDest, BasicBlock *UnwindDest, uint32_t Flags, - ArrayRef InvokeArgs, Optional> TransitionArgs, + ArrayRef InvokeArgs, Optional> TransitionArgs, Optional> DeoptArgs, ArrayRef GCArgs, const Twine &Name = ""); diff --git a/llvm/lib/IR/IRBuilder.cpp b/llvm/lib/IR/IRBuilder.cpp index 982a158ff5c042..c0e4451f52003c 100644 --- a/llvm/lib/IR/IRBuilder.cpp +++ b/llvm/lib/IR/IRBuilder.cpp @@ -653,10 +653,10 @@ CallInst *IRBuilderBase::CreateGCStatepointCall( CallInst *IRBuilderBase::CreateGCStatepointCall( uint64_t ID, uint32_t NumPatchBytes, Value *ActualCallee, uint32_t Flags, - ArrayRef CallArgs, Optional> TransitionArgs, + ArrayRef CallArgs, Optional> TransitionArgs, Optional> DeoptArgs, ArrayRef GCArgs, const Twine &Name) { - return CreateGCStatepointCallCommon( + return CreateGCStatepointCallCommon( this, ID, NumPatchBytes, ActualCallee, Flags, CallArgs, TransitionArgs, DeoptArgs, GCArgs, Name); } @@ -711,9 +711,9 @@ InvokeInst *IRBuilderBase::CreateGCStatepointInvoke( InvokeInst *IRBuilderBase::CreateGCStatepointInvoke( uint64_t ID, uint32_t NumPatchBytes, Value *ActualInvokee, BasicBlock *NormalDest, BasicBlock *UnwindDest, uint32_t Flags, - ArrayRef InvokeArgs, Optional> TransitionArgs, + ArrayRef InvokeArgs, Optional> TransitionArgs, Optional> DeoptArgs, ArrayRef GCArgs, const Twine &Name) { - return CreateGCStatepointInvokeCommon( + return CreateGCStatepointInvokeCommon( this, ID, NumPatchBytes, ActualInvokee, NormalDest, UnwindDest, Flags, InvokeArgs, TransitionArgs, DeoptArgs, GCArgs, Name); } diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp index c344c6c6847761..0769b23f903b26 100644 --- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -1487,7 +1487,9 @@ makeStatepointExplicitImpl(CallBase *Call, /* to replace */ uint32_t NumPatchBytes = 0; uint32_t Flags = uint32_t(StatepointFlags::None); - ArrayRef CallArgs(Call->arg_begin(), Call->arg_end()); + SmallVector CallArgs; + for (Value *Arg : Call->args()) + CallArgs.push_back(Arg); Optional> DeoptArgs; if (auto Bundle = Call->getOperandBundle(LLVMContext::OB_deopt)) DeoptArgs = Bundle->Inputs; @@ -1520,7 +1522,8 @@ makeStatepointExplicitImpl(CallBase *Call, /* to replace */ Value *CallTarget = Call->getCalledOperand(); if (Function *F = dyn_cast(CallTarget)) { - if (F->getIntrinsicID() == Intrinsic::experimental_deoptimize) { + auto IID = F->getIntrinsicID(); + if (IID == Intrinsic::experimental_deoptimize) { // Calls to llvm.experimental.deoptimize are lowered to calls to the // __llvm_deoptimize symbol. We want to resolve this now, since the // verifier does not allow taking the address of an intrinsic function.