[PATCH] D155158: [TableGen][CodeEmitterGen] Fix SubOpAliases MIOperandNo mixup

Ilya Leoshkevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 00:22:05 PDT 2023


iii created this revision.
iii added reviewers: MaskRay, jyknight.
Herald added a subscriber: jeroen.dobbelaere.
Herald added a project: All.
iii requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

SubOpAliases maps a sub-operand name to the respective operand's index
and the sub-operand number within this operand. The operand index is
used for the Operands array.

Currently MIOperandNo is used as the operand index, which is not
correct. For example, if there are 2 operands with 3 sub-operands each:

  (ins (bdladdr12onlylen4 $B1, $D1, $L1):$BDL1,
       (bdladdr12onlylen4 $B2, $D2, $L2):$BDL2)

then B2 <https://reviews.llvm.org/B2>'s operand index will be 3, but the correct value is 1.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155158

Files:
  llvm/utils/TableGen/CodeGenInstruction.cpp


Index: llvm/utils/TableGen/CodeGenInstruction.cpp
===================================================================
--- llvm/utils/TableGen/CodeGenInstruction.cpp
+++ llvm/utils/TableGen/CodeGenInstruction.cpp
@@ -175,7 +175,7 @@
         }
 
         OpInfo.SubOpNames[j] = SubArgName;
-        SubOpAliases[SubArgName] = std::make_pair(MIOperandNo, j);
+        SubOpAliases[SubArgName] = std::make_pair(i, j);
       }
     } else if (!EncoderMethod.empty()) {
       // If we have no explicit sub-op dag, but have an top-level encoder


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155158.539867.patch
Type: text/x-patch
Size: 541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230713/4db458ce/attachment.bin>


More information about the llvm-commits mailing list