[llvm] 457c9ae - [TableGen] Simplify how we calculate NumMIOperands in addDagOperandMapping. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 27 14:59:18 PDT 2025
Author: Craig Topper
Date: 2025-06-27T14:58:39-07:00
New Revision: 457c9aec9e845d09202ed8de83be122b9b58d2d7
URL: https://github.com/llvm/llvm-project/commit/457c9aec9e845d09202ed8de83be122b9b58d2d7
DIFF: https://github.com/llvm/llvm-project/commit/457c9aec9e845d09202ed8de83be122b9b58d2d7.diff
LOG: [TableGen] Simplify how we calculate NumMIOperands in addDagOperandMapping. NFC
We can use the MIOperandNo and NumMIOperands from the last operand
instead using a loop.
Added:
Modified:
llvm/utils/TableGen/CompressInstEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/CompressInstEmitter.cpp b/llvm/utils/TableGen/CompressInstEmitter.cpp
index 4e307c6504c86..9da64365bc361 100644
--- a/llvm/utils/TableGen/CompressInstEmitter.cpp
+++ b/llvm/utils/TableGen/CompressInstEmitter.cpp
@@ -212,8 +212,9 @@ void CompressInstEmitter::addDagOperandMapping(const Record *Rec,
bool IsSourceInst,
unsigned *SourceLastTiedOpPtr) {
unsigned NumMIOperands = 0;
- for (const auto &Op : Inst.Operands)
- NumMIOperands += Op.MINumOperands;
+ if (!Inst.Operands.empty())
+ NumMIOperands =
+ Inst.Operands.back().MIOperandNo + Inst.Operands.back().MINumOperands;
OperandMap.grow(NumMIOperands);
// TiedCount keeps track of the number of operands skipped in Inst
More information about the llvm-commits
mailing list