Index: include/llvm/Target/TargetLowering.h =================================================================== --- include/llvm/Target/TargetLowering.h +++ include/llvm/Target/TargetLowering.h @@ -2906,7 +2906,7 @@ RetTy = ResultType; Callee = Target; CallConv = CC; - NumFixedArgs = Args.size(); + NumFixedArgs = ArgsList.size(); Args = std::move(ArgsList); DAG.getTargetLoweringInfo().markLibCallAttributes( @@ -2919,7 +2919,7 @@ RetTy = ResultType; Callee = Target; CallConv = CC; - NumFixedArgs = Args.size(); + NumFixedArgs = ArgsList.size(); Args = std::move(ArgsList); return *this; } Index: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -8046,6 +8046,7 @@ Entry.IsSwiftError = false; Entry.Alignment = Align; CLI.getArgs().insert(CLI.getArgs().begin(), Entry); + CLI.NumFixedArgs += 1; CLI.RetTy = Type::getVoidTy(CLI.RetTy->getContext()); // sret demotion isn't compatible with tail-calls, since the sret argument