@@ -298,22 +298,19 @@ static bool verifyDagOpCount(const CodeGenInstruction &Inst, const DagInit *Dag,
298
298
bool IsSource) {
299
299
unsigned NumMIOperands = 0 ;
300
300
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 ;
305
302
for (const auto &Op : Inst.Operands ) {
306
303
NumMIOperands += Op.MINumOperands ;
307
304
if (Op.getTiedRegister () != -1 )
308
- SourceInstTiedOpCount ++;
305
+ TiedOpCount ++;
309
306
}
310
307
311
308
if (Dag->getNumArgs () == NumMIOperands)
312
309
return true ;
313
310
314
311
// Source instructions are non compressed instructions and have at most one
315
312
// tied operand.
316
- if (IsSource && (SourceInstTiedOpCount >= 2 ))
313
+ if (IsSource && (TiedOpCount > 1 ))
317
314
PrintFatalError (Inst.TheDef ->getLoc (),
318
315
" Input operands for Inst '" + Inst.TheDef ->getName () +
319
316
" ' and input Dag operand count mismatch" );
@@ -326,12 +323,7 @@ static bool verifyDagOpCount(const CodeGenInstruction &Inst, const DagInit *Dag,
326
323
327
324
// The Instruction might have tied operands so the Dag might have
328
325
// 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))
335
327
PrintFatalError (Inst.TheDef ->getLoc (),
336
328
" Inst '" + Inst.TheDef ->getName () +
337
329
" ' and Dag operand count mismatch" );
0 commit comments