Skip to content

Commit 457c9ae

Browse files
committed
[TableGen] Simplify how we calculate NumMIOperands in addDagOperandMapping. NFC
We can use the MIOperandNo and NumMIOperands from the last operand instead using a loop.
1 parent 8bc61cb commit 457c9ae

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/utils/TableGen/CompressInstEmitter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,9 @@ void CompressInstEmitter::addDagOperandMapping(const Record *Rec,
212212
bool IsSourceInst,
213213
unsigned *SourceLastTiedOpPtr) {
214214
unsigned NumMIOperands = 0;
215-
for (const auto &Op : Inst.Operands)
216-
NumMIOperands += Op.MINumOperands;
215+
if (!Inst.Operands.empty())
216+
NumMIOperands =
217+
Inst.Operands.back().MIOperandNo + Inst.Operands.back().MINumOperands;
217218
OperandMap.grow(NumMIOperands);
218219

219220
// TiedCount keeps track of the number of operands skipped in Inst

0 commit comments

Comments
 (0)