From e368cb378f1e5118931bd83ba8694fa19160d900 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Thu, 11 Dec 2014 23:37:32 +0000 Subject: [PATCH] R600/SI: Don't verify constant bus usage of flag ops This was checking if pseudo-operands like the source modifiers were using the constant bus, which happens to work because the values these all can be happen to be valid inline immediates. This fixes a later commit which starts checking the register class of the operands. llvm-svn: 224078 --- llvm/lib/Target/R600/SIInstrInfo.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/R600/SIInstrInfo.cpp b/llvm/lib/Target/R600/SIInstrInfo.cpp index 42f10f2..4aa5ac8 100644 --- a/llvm/lib/Target/R600/SIInstrInfo.cpp +++ b/llvm/lib/Target/R600/SIInstrInfo.cpp @@ -1107,10 +1107,18 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr *MI, // Verify VOP* if (isVOP1(Opcode) || isVOP2(Opcode) || isVOP3(Opcode) || isVOPC(Opcode)) { + // 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 }; + unsigned ConstantBusCount = 0; unsigned SGPRUsed = AMDGPU::NoRegister; - for (int i = 0, e = MI->getNumOperands(); i != e; ++i) { - const MachineOperand &MO = MI->getOperand(i); + for (int OpIdx : OpIndices) { + if (OpIdx == -1) + break; + + const MachineOperand &MO = MI->getOperand(OpIdx); if (usesConstantBus(MRI, MO)) { if (MO.isReg()) { if (MO.getReg() != SGPRUsed) -- 2.7.4