Skip to content

Commit 9a93de5

Browse files
committed
[TableGen] Simplify copying OperandMap entries for tied operands in CompressInstEmitter. NFC
Copy the whole struct instead of copying both fields.
1 parent 457c9ae commit 9a93de5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/utils/TableGen/CompressInstEmitter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ void CompressInstEmitter::addDagOperandMapping(const Record *Rec,
229229
for (const auto &Opnd : Inst.Operands) {
230230
int TiedOpIdx = Opnd.getTiedRegister();
231231
if (-1 != TiedOpIdx) {
232+
assert((unsigned)TiedOpIdx < OpNo);
232233
// Set the entry in OperandMap for the tied operand we're skipping.
233-
OperandMap[OpNo].Kind = OperandMap[TiedOpIdx].Kind;
234-
OperandMap[OpNo].Data = OperandMap[TiedOpIdx].Data;
234+
OperandMap[OpNo] = OperandMap[TiedOpIdx];
235235
if (IsSourceInst)
236236
*SourceLastTiedOpPtr = OpNo;
237237
++OpNo;
@@ -405,8 +405,8 @@ void CompressInstEmitter::createInstOperandMapping(
405405
int TiedInstOpIdx = Operand.getTiedRegister();
406406
if (TiedInstOpIdx != -1) {
407407
++TiedCount;
408-
DestOperandMap[OpNo].Data = DestOperandMap[TiedInstOpIdx].Data;
409-
DestOperandMap[OpNo].Kind = DestOperandMap[TiedInstOpIdx].Kind;
408+
assert((unsigned)TiedInstOpIdx < OpNo);
409+
DestOperandMap[OpNo] = DestOperandMap[TiedInstOpIdx];
410410
if (DestOperandMap[OpNo].Kind == OpData::Operand)
411411
// No need to fill the SourceOperandMap here since it was mapped to
412412
// destination operand 'TiedInstOpIdx' in a previous iteration.

0 commit comments

Comments
 (0)