@@ -298,22 +298,19 @@ static bool verifyDagOpCount(const CodeGenInstruction &Inst, const DagInit *Dag,
298298 bool IsSource) {
299299 unsigned NumMIOperands = 0 ;
300300
301- // Use this to count number of tied Operands in Source Inst in this function.
302- // This counter is required here to error out when there is a Source
303- // Inst with two or more tied operands.
304- unsigned SourceInstTiedOpCount = 0 ;
301+ unsigned TiedOpCount = 0 ;
305302 for (const auto &Op : Inst.Operands ) {
306303 NumMIOperands += Op.MINumOperands ;
307304 if (Op.getTiedRegister () != -1 )
308- SourceInstTiedOpCount ++;
305+ TiedOpCount ++;
309306 }
310307
311308 if (Dag->getNumArgs () == NumMIOperands)
312309 return true ;
313310
314311 // Source instructions are non compressed instructions and have at most one
315312 // tied operand.
316- if (IsSource && (SourceInstTiedOpCount >= 2 ))
313+ if (IsSource && (TiedOpCount > 1 ))
317314 PrintFatalError (Inst.TheDef ->getLoc (),
318315 " Input operands for Inst '" + Inst.TheDef ->getName () +
319316 " ' and input Dag operand count mismatch" );
@@ -326,12 +323,7 @@ static bool verifyDagOpCount(const CodeGenInstruction &Inst, const DagInit *Dag,
326323
327324 // The Instruction might have tied operands so the Dag might have
328325 // a fewer operand count.
329- unsigned RealCount = NumMIOperands;
330- for (const auto &Operand : Inst.Operands )
331- if (Operand.getTiedRegister () != -1 )
332- --RealCount;
333-
334- if (Dag->getNumArgs () != RealCount)
326+ if (Dag->getNumArgs () != (NumMIOperands - TiedOpCount))
335327 PrintFatalError (Inst.TheDef ->getLoc (),
336328 " Inst '" + Inst.TheDef ->getName () +
337329 " ' and Dag operand count mismatch" );
0 commit comments