diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp index 5afd0bba095b2..1310580756f4b 100644 --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp @@ -4134,9 +4134,7 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI, int DstIdx = AMDGPU::getNamedOperandIdx(Opcode, AMDGPU::OpName::vdst); - const int OpIndices[] = {DstIdx, Src0Idx, Src1Idx, Src2Idx}; - - for (int OpIdx : OpIndices) { + for (int OpIdx : {DstIdx, Src0Idx, Src1Idx, Src2Idx}) { if (OpIdx == -1) continue; const MachineOperand &MO = MI.getOperand(OpIdx); @@ -4253,13 +4251,7 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI, } // Verify VOP*. Ignore multiple sgpr operands on writelane. - if (Desc.getOpcode() != AMDGPU::V_WRITELANE_B32 - && (isVOP1(MI) || isVOP2(MI) || isVOP3(MI) || isVOPC(MI) || isSDWA(MI))) { - // Only look at the true operands. Only a real operand can use the constant - // bus, and we don't want to check pseudo-operands like the source modifier - // flags. - const int OpIndices[] = { Src0Idx, Src1Idx, Src2Idx }; - + if (isVALU(MI) && Desc.getOpcode() != AMDGPU::V_WRITELANE_B32) { unsigned ConstantBusCount = 0; bool UsesLiteral = false; const MachineOperand *LiteralVal = nullptr; @@ -4270,7 +4262,10 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI, SmallVector SGPRsUsed; Register SGPRUsed; - for (int OpIdx : OpIndices) { + // Only look at the true operands. Only a real operand can use the constant + // bus, and we don't want to check pseudo-operands like the source modifier + // flags. + for (int OpIdx : {Src0Idx, Src1Idx, Src2Idx}) { if (OpIdx == -1) break; const MachineOperand &MO = MI.getOperand(OpIdx); @@ -4328,7 +4323,7 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI, unsigned SGPRCount = 0; Register SGPRUsed = AMDGPU::NoRegister; - for (int OpIdx : {Src0Idx, Src1Idx, Src2Idx}) { + for (int OpIdx : {Src0Idx, Src1Idx}) { if (OpIdx == -1) break; @@ -4580,7 +4575,6 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI, } int DstIdx = AMDGPU::getNamedOperandIdx(Opcode, AMDGPU::OpName::vdst); - int Src0Idx = AMDGPU::getNamedOperandIdx(Opcode, AMDGPU::OpName::src0); if (Opcode != AMDGPU::V_MOV_B64_DPP_PSEUDO && ((DstIdx >= 0 &&