Skip to content

Commit 67c98a0

Browse files
committed
[NFC][TableGen] Create valid Dag in VarLenCodeEmitter
- Set the Dag ArgNames correctly when normalizing the Dag for slice.
1 parent bf1d4a0 commit 67c98a0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/utils/TableGen/Common/VarLenCodeEmitterGen.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ void VarLenInst::buildRec(const DagInit *DI) {
212212

213213
if (NeedSwap) {
214214
// Normalization: Hi bit should always be the second argument.
215-
const Init *const NewArgs[] = {OperandName, LoBit, HiBit};
216-
// TODO: This creates an invalid DagInit with 3 Args but 0 ArgNames.
217-
// Extend unit test to exercise this and fix it.
218-
Segments.push_back({NumBits, DagInit::get(DI->getOperator(), NewArgs, {}),
215+
SmallVector<std::pair<const Init *, const StringInit *>> NewArgs(
216+
DI->getArgAndNames());
217+
std::swap(NewArgs[1], NewArgs[2]);
218+
Segments.push_back({NumBits, DagInit::get(DI->getOperator(), NewArgs),
219219
CustomEncoder, CustomDecoder});
220220
} else {
221221
Segments.push_back({NumBits, DI, CustomEncoder, CustomDecoder});

0 commit comments

Comments
 (0)