@@ -129,28 +129,29 @@ void SILateBranchLowering::expandChainCall(MachineInstr &MI,
129129 bool DynamicVGPR) {
130130 // This is a tail call that needs to be expanded into at least
131131 // 2 instructions, one for setting EXEC and one for the actual tail call.
132- unsigned ExecIdx =
132+ int ExecIdx =
133133 AMDGPU::getNamedOperandIdx (MI.getOpcode (), AMDGPU::OpName::exec);
134+ assert (ExecIdx != -1 && " Missing EXEC operand" );
135+ const DebugLoc &DL = MI.getDebugLoc ();
134136 if (DynamicVGPR) {
135137 // We have 3 extra operands and we need to:
136138 // * Try to change the VGPR allocation
137139 // * Select the callee based on the result of the reallocation attempt
138140 // * Select the EXEC mask based on the result of the reallocation attempt
139- auto AllocMI = BuildMI (*MI. getParent (), MI, MI. getDebugLoc (),
140- TII->get (AMDGPU::S_ALLOC_VGPR));
141+ auto AllocMI =
142+ BuildMI (*MI. getParent (), MI, DL, TII->get (AMDGPU::S_ALLOC_VGPR));
141143 addRegOrCopyOp (AllocMI,
142144 *TII->getNamedOperand (MI, AMDGPU::OpName::numvgprs));
143145
144146 auto SelectCallee =
145- BuildMI (*MI.getParent (), MI, MI.getDebugLoc (),
146- TII->get (AMDGPU::S_CSELECT_B64))
147+ BuildMI (*MI.getParent (), MI, DL, TII->get (AMDGPU::S_CSELECT_B64))
147148 .addDef (TII->getNamedOperand (MI, AMDGPU::OpName::src0)->getReg ());
148149 addRegOrCopyOp (SelectCallee,
149150 *TII->getNamedOperand (MI, AMDGPU::OpName::src0));
150151 addRegOrCopyOp (SelectCallee,
151152 *TII->getNamedOperand (MI, AMDGPU::OpName::fbcallee));
152153
153- auto SelectExec = BuildMI (*MI.getParent (), MI, MI. getDebugLoc () ,
154+ auto SelectExec = BuildMI (*MI.getParent (), MI, DL ,
154155 TII->get (ST.isWave32 () ? AMDGPU::S_CSELECT_B32
155156 : AMDGPU::S_CSELECT_B64))
156157 .addDef (ExecReg);
@@ -159,8 +160,7 @@ void SILateBranchLowering::expandChainCall(MachineInstr &MI,
159160 addRegOrCopyOp (SelectExec,
160161 *TII->getNamedOperand (MI, AMDGPU::OpName::fbexec));
161162 } else {
162- auto SetExec = BuildMI (*MI.getParent (), MI, MI.getDebugLoc (),
163- TII->get (MovOpc), ExecReg);
163+ auto SetExec = BuildMI (*MI.getParent (), MI, DL, TII->get (MovOpc), ExecReg);
164164 addRegOrCopyOp (SetExec, *TII->getNamedOperand (MI, AMDGPU::OpName::exec));
165165 }
166166
0 commit comments