[llvm] [TableGen][GlobalISel] Add rule-wide type inference (PR #66377)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 14 06:56:29 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-amdgpu
            
<details>
<summary>Changes</summary>
NOTE: This is part of a stack. Please only review the last commit, see #66079 for the previous commit(s).

The inference is trivial and leverages the MCOI OperandTypes encoded in
CodeGenInstructions to infer types across patterns in a CombineRule. It's
thus very limited and only supports CodeGenInstructions (but that's the main
use case so it's fine).

We only try to infer untyped operands in apply patterns when they're temp
reg defs, or immediates. Inference always outputs a `TypeOf<$x>` where $x is
a named operand from a match pattern.

This allows us to drop the `GITypeOf` in #66079 without errors.
--

Patch is 178.41 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/66377.diff

31 Files Affected:

- (modified) llvm/docs/GlobalISel/MIRPatterns.rst (+44-2) 
- (modified) llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h (-3) 
- (modified) llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h (+43-17) 
- (modified) llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h (+79-46) 
- (modified) llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h (+10) 
- (modified) llvm/include/llvm/Target/GenericOpcodes.td (+7) 
- (modified) llvm/include/llvm/Target/GlobalISel/Combine.td (+21-4) 
- (modified) llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp (-12) 
- (modified) llvm/lib/CodeGen/GlobalISel/GIMatchTableExecutor.cpp (+4) 
- (modified) llvm/test/CodeGen/AArch64/GlobalISel/combine-sdiv.mir (+14-14) 
- (modified) llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-ashr-shl-to-sext-inreg.mir (+2-2) 
- (modified) llvm/test/CodeGen/AMDGPU/GlobalISel/combine-fma-add-mul-pre-legalize.mir (+48-48) 
- (modified) llvm/test/CodeGen/AMDGPU/GlobalISel/combine-fma-unmerge-values.mir (+10-10) 
- (modified) llvm/test/CodeGen/AMDGPU/GlobalISel/combine-fold-binop-into-select.mir (+10-10) 
- (modified) llvm/test/CodeGen/AMDGPU/GlobalISel/combine-fsub-fneg.mir (+14-14) 
- (modified) llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td (+5-7) 
- (modified) llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-patfrag-root.td (+9-15) 
- (modified) llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-permutations.td (+26-42) 
- (added) llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-typeof.td (+49) 
- (modified) llvm/test/TableGen/GlobalISelCombinerEmitter/match-table.td (+6-8) 
- (modified) llvm/test/TableGen/GlobalISelCombinerEmitter/operand-types.td (+27-1) 
- (modified) llvm/test/TableGen/GlobalISelCombinerEmitter/pattern-errors.td (+2-2) 
- (modified) llvm/test/TableGen/GlobalISelCombinerEmitter/pattern-parsing.td (+24-1) 
- (added) llvm/test/TableGen/GlobalISelCombinerEmitter/type-inference.td (+75) 
- (added) llvm/test/TableGen/GlobalISelCombinerEmitter/typeof-errors.td (+75) 
- (modified) llvm/test/TableGen/GlobalISelEmitter.td (+3-3) 
- (modified) llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp (+744-84) 
- (modified) llvm/utils/TableGen/GlobalISelEmitter.cpp (+4-3) 
- (modified) llvm/utils/TableGen/GlobalISelMatchTable.cpp (+42-3) 
- (modified) llvm/utils/TableGen/GlobalISelMatchTable.h (+100-8) 
- (modified) llvm/utils/TableGen/GlobalISelMatchTableExecutorEmitter.cpp (+1-1) 


<pre>
diff --git a/llvm/docs/GlobalISel/MIRPatterns.rst b/llvm/docs/GlobalISel/MIRPatterns.rst
index 51d1850a1236039..a3883b14b3e0bd6 100644
--- a/llvm/docs/GlobalISel/MIRPatterns.rst
+++ b/llvm/docs/GlobalISel/MIRPatterns.rst
@@ -101,6 +101,48 @@ pattern, you can try naming your patterns to see exactly where the issue is.
   // using $x again here copies operand 1 from G_AND into the new inst.
   (apply (COPY $root, $x))
 
+Types
+-----
+
+ValueType
+~~~~~~~~~
+
+Subclasses of ``ValueType`` are valid types, e.g. ``i32``.
+
+GITypeOf
+~~~~~~~~
+
+``GITypeOf&lt;&quot;$x&quot;&gt;`` is a ``GISpecialType`` that allows for the creation of a
+register or immediate with the same type as another (register) operand.
+
+Operand:
+
+* An operand name as a string, prefixed by ``$``.
+
+Semantics:
+
+* Can only appear in an &#x27;apply&#x27; pattern.
+* The operand name used must appear in the &#x27;match&#x27; pattern of the
+  same ``GICombineRule``.
+
+.. code-block:: text
+  :caption: Example: Immediate
+
+  def mul_by_neg_one: GICombineRule &lt;
+    (defs root:$root),
+    (match (G_MUL $dst, $x, -1)),
+    (apply (G_SUB $dst, (GITypeOf&lt;&quot;$x&quot;&gt; 0), $x))
+  &gt;;
+
+.. code-block:: text
+  :caption: Example: Temp Reg
+
+  def Test0 : GICombineRule&lt;
+    (defs root:$dst),
+    (match (G_FMUL $dst, $src, -1)),
+    (apply (G_FSUB $dst, $src, $tmp),
+           (G_FNEG GITypeOf&lt;&quot;$dst&quot;&gt;:$tmp, $src))&gt;;
+
 Builtin Operations
 ------------------
 
@@ -257,8 +299,8 @@ Common Pattern #3: Emitting a Constant Value
 When an immediate operand appears in an &#x27;apply&#x27; pattern, the behavior
 depends on whether it&#x27;s typed or not.
 
-* If the immediate is typed, a ``G_CONSTANT`` is implicitly emitted
-  (= a register operand is added to the instruction).
+* If the immediate is typed, ``MachineIRBuilder::buildConstant`` is used
+  to create a ``G_CONSTANT``. A ``G_BUILD_VECTOR`` will be used for vectors.
 * If the immediate is untyped, a simple immediate is added
   (``MachineInstrBuilder::addImm``).
 
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h b/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
index b7c0cd4fc47faff..a896232618948a0 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
@@ -406,9 +406,6 @@ class CombinerHelper {
   void applyCombineTruncOfShift(MachineInstr &amp;MI,
                                 std::pair&lt;MachineInstr *, LLT&gt; &amp;MatchInfo);
 
-  /// Transform G_MUL(x, -1) to G_SUB(0, x)
-  void applyCombineMulByNegativeOne(MachineInstr &amp;MI);
-
   /// Return true if any explicit use operand on \p MI is defined by a
   /// G_IMPLICIT_DEF.
   bool matchAnyExplicitUseIsUndef(MachineInstr &amp;MI);
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
index 2b0733cf9353e6c..2a893b81db72abf 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
@@ -18,6 +18,7 @@
 #include &quot;llvm/ADT/Bitset.h&quot;
 #include &quot;llvm/ADT/DenseMap.h&quot;
 #include &quot;llvm/ADT/SmallVector.h&quot;
+#include &quot;llvm/CodeGen/GlobalISel/GISelChangeObserver.h&quot;
 #include &quot;llvm/CodeGen/GlobalISel/Utils.h&quot;
 #include &quot;llvm/CodeGen/LowLevelType.h&quot;
 #include &quot;llvm/CodeGen/MachineFunction.h&quot;
@@ -40,6 +41,7 @@ class APInt;
 class APFloat;
 class GISelKnownBits;
 class MachineInstr;
+class MachineIRBuilder;
 class MachineInstrBuilder;
 class MachineFunction;
 class MachineOperand;
@@ -274,6 +276,12 @@ enum {
   /// - StoreIdx - Store location in RecordedOperands.
   GIM_RecordNamedOperand,
 
+  /// Records an operand&#x27;s register type into the set of temporary types.
+  /// - InsnID - Instruction ID
+  /// - OpIdx - Operand index
+  /// - TempTypeIdx - Temp Type Index, always negative.
+  GIM_RecordRegType,
+
   /// Fail the current try-block, or completely fail to match if there is no
   /// current try-block.
   GIM_Reject,
@@ -291,6 +299,11 @@ enum {
   /// - Opcode - The new opcode to use
   GIR_BuildMI,
 
+  /// Builds a constant and stores its result in a TempReg.
+  /// - TempRegID - Temp Register to define.
+  /// - Imm - The immediate to add
+  GIR_BuildConstant,
+
   /// Copy an operand to the specified instruction
   /// - NewInsnID - Instruction ID to modify
   /// - OldInsnID - Instruction ID to copy from
@@ -350,12 +363,6 @@ enum {
   /// - Imm - The immediate to add
   GIR_AddImm,
 
-  /// Add an CImm to the specified instruction
-  /// - InsnID - Instruction ID to modify
-  /// - Ty - Type of the constant immediate.
-  /// - Imm - The immediate to add
-  GIR_AddCImm,
-
   /// Render complex operands to the specified instruction
   /// - InsnID - Instruction ID to modify
   /// - RendererID - The renderer to call
@@ -501,10 +508,25 @@ class GIMatchTableExecutor {
   }
 
 protected:
+  /// Observer used by \ref executeMatchTable to record all instructions created
+  /// by the rule.
+  class GIMatchTableObserver : public GISelChangeObserver {
+  public:
+    virtual ~GIMatchTableObserver();
+
+    void erasingInstr(MachineInstr &amp;MI) override { CreatedInsts.erase(&amp;MI); }
+    void createdInstr(MachineInstr &amp;MI) override { CreatedInsts.insert(&amp;MI); }
+    void changingInstr(MachineInstr &amp;MI) override {}
+    void changedInstr(MachineInstr &amp;MI) override {}
+
+    // Keeps track of all instructions that have been created when applying a
+    // rule.
+    SmallDenseSet&lt;MachineInstr *, 4&gt; CreatedInsts;
+  };
+
   using ComplexRendererFns =
       std::optional&lt;SmallVector&lt;std::function&lt;void(MachineInstrBuilder &amp;)&gt;, 4&gt;&gt;;
   using RecordedMIVector = SmallVector&lt;MachineInstr *, 4&gt;;
-  using NewMIVector = SmallVector&lt;MachineInstrBuilder, 4&gt;;
 
   struct MatcherState {
     std::vector&lt;ComplexRendererFns::value_type&gt; Renderers;
@@ -516,6 +538,10 @@ class GIMatchTableExecutor {
     /// list. Currently such predicates don&#x27;t have more then 3 arguments.
     std::array&lt;const MachineOperand *, 3&gt; RecordedOperands;
 
+    /// Types extracted from an instruction&#x27;s operand.
+    /// Whenever a type index is negative, we look here instead.
+    SmallVector&lt;LLT, 4&gt; RecordedTypes;
+
     MatcherState(unsigned MaxRenderers);
   };
 
@@ -555,15 +581,15 @@ class GIMatchTableExecutor {
   /// and false otherwise.
   template &lt;class TgtExecutor, class PredicateBitset, class ComplexMatcherMemFn,
             class CustomRendererFn&gt;
-  bool executeMatchTable(
-      TgtExecutor &amp;Exec, NewMIVector &amp;OutMIs, MatcherState &amp;State,
-      const ExecInfoTy&lt;PredicateBitset, ComplexMatcherMemFn, CustomRendererFn&gt;
-          &amp;ISelInfo,
-      const int64_t *MatchTable, const TargetInstrInfo &amp;TII,
-      MachineRegisterInfo &amp;MRI, const TargetRegisterInfo &amp;TRI,
-      const RegisterBankInfo &amp;RBI, const PredicateBitset &amp;AvailableFeatures,
-      CodeGenCoverage *CoverageInfo,
-      GISelChangeObserver *Observer = nullptr) const;
+  bool executeMatchTable(TgtExecutor &amp;Exec, MatcherState &amp;State,
+                         const ExecInfoTy&lt;PredicateBitset, ComplexMatcherMemFn,
+                                          CustomRendererFn&gt; &amp;ExecInfo,
+                         MachineIRBuilder &amp;Builder, const int64_t *MatchTable,
+                         const TargetInstrInfo &amp;TII, MachineRegisterInfo &amp;MRI,
+                         const TargetRegisterInfo &amp;TRI,
+                         const RegisterBankInfo &amp;RBI,
+                         const PredicateBitset &amp;AvailableFeatures,
+                         CodeGenCoverage *CoverageInfo) const;
 
   virtual const int64_t *getMatchTable() const {
     llvm_unreachable(&quot;Should have been overridden by tablegen if used&quot;);
@@ -592,7 +618,7 @@ class GIMatchTableExecutor {
   }
 
   virtual void runCustomAction(unsigned, const MatcherState &amp;State,
-                               NewMIVector &amp;OutMIs) const {
+                               ArrayRef&lt;MachineInstrBuilder&gt; OutMIs) const {
     llvm_unreachable(&quot;Subclass does not implement runCustomAction!&quot;);
   }
 
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
index 883c1ca0fe350b0..fa8bddf795a9a7f 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
@@ -18,6 +18,7 @@
 #include &quot;llvm/ADT/SmallVector.h&quot;
 #include &quot;llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h&quot;
 #include &quot;llvm/CodeGen/GlobalISel/GISelChangeObserver.h&quot;
+#include &quot;llvm/CodeGen/GlobalISel/MachineIRBuilder.h&quot;
 #include &quot;llvm/CodeGen/GlobalISel/Utils.h&quot;
 #include &quot;llvm/CodeGen/MachineInstrBuilder.h&quot;
 #include &quot;llvm/CodeGen/MachineOperand.h&quot;
@@ -42,17 +43,33 @@ namespace llvm {
 template &lt;class TgtExecutor, class PredicateBitset, class ComplexMatcherMemFn,
           class CustomRendererFn&gt;
 bool GIMatchTableExecutor::executeMatchTable(
-    TgtExecutor &amp;Exec, NewMIVector &amp;OutMIs, MatcherState &amp;State,
+    TgtExecutor &amp;Exec, MatcherState &amp;State,
     const ExecInfoTy&lt;PredicateBitset, ComplexMatcherMemFn, CustomRendererFn&gt;
         &amp;ExecInfo,
-    const int64_t *MatchTable, const TargetInstrInfo &amp;TII,
-    MachineRegisterInfo &amp;MRI, const TargetRegisterInfo &amp;TRI,
-    const RegisterBankInfo &amp;RBI, const PredicateBitset &amp;AvailableFeatures,
-    CodeGenCoverage *CoverageInfo, GISelChangeObserver *Observer) const {
+    MachineIRBuilder &amp;Builder, const int64_t *MatchTable,
+    const TargetInstrInfo &amp;TII, MachineRegisterInfo &amp;MRI,
+    const TargetRegisterInfo &amp;TRI, const RegisterBankInfo &amp;RBI,
+    const PredicateBitset &amp;AvailableFeatures,
+    CodeGenCoverage *CoverageInfo) const {
+
+  // Setup observer
+  GIMatchTableObserver MTObserver;
+  GISelObserverWrapper Observer(&amp;MTObserver);
+  if (auto *CurObs = Builder.getChangeObserver())
+    Observer.addObserver(CurObs);
+
+  // TODO: Set MF delegate?
+
+  // Setup builder.
+  auto RestoreOldObserver = Builder.setTemporaryChangeObserver(Observer);
 
   uint64_t CurrentIdx = 0;
   SmallVector&lt;uint64_t, 4&gt; OnFailResumeAt;
 
+  // We also record MachineInstrs manually in this vector so opcodes can address
+  // them.
+  SmallVector&lt;MachineInstrBuilder, 4&gt; OutMIs;
+
   // Bypass the flag check on the instruction, and only look at the MCInstrDesc.
   bool NoFPException = !State.MIs[0]-&gt;getDesc().mayRaiseFPException();
 
@@ -71,19 +88,29 @@ bool GIMatchTableExecutor::executeMatchTable(
     return RejectAndResume;
   };
 
-  auto propagateFlags = [=](NewMIVector &amp;OutMIs) {
-    for (auto MIB : OutMIs) {
+  auto propagateFlags = [&amp;]() {
+    for (auto *MI : MTObserver.CreatedInsts) {
       // Set the NoFPExcept flag when no original matched instruction could
       // raise an FP exception, but the new instruction potentially might.
       uint16_t MIBFlags = Flags;
-      if (NoFPException &amp;&amp; MIB-&gt;mayRaiseFPException())
+      if (NoFPException &amp;&amp; MI-&gt;mayRaiseFPException())
         MIBFlags |= MachineInstr::NoFPExcept;
-      MIB.setMIFlags(MIBFlags);
+      Observer.changingInstr(*MI);
+      MI-&gt;setFlags(MIBFlags);
+      Observer.changedInstr(*MI);
     }
 
     return true;
   };
 
+  // If the index is &gt;= 0, it&#x27;s an index in the type objects generated by TableGen.
+  // If the index is &lt;0, it&#x27;s an index in the recorded types object.
+  auto getTypeFromIdx = [&amp;](int64_t Idx) -&gt; const LLT&amp; {
+    if(Idx &gt;= 0)
+      return ExecInfo.TypeObjects[Idx];
+    return State.RecordedTypes[1 - Idx];
+  };
+
   while (true) {
     assert(CurrentIdx != ~0u &amp;&amp; &quot;Invalid MatchTable index&quot;);
     int64_t MatcherOpcode = MatchTable[CurrentIdx++];
@@ -620,7 +647,7 @@ bool GIMatchTableExecutor::executeMatchTable(
       assert(State.MIs[InsnID] != nullptr &amp;&amp; &quot;Used insn before defined&quot;);
       MachineOperand &amp;MO = State.MIs[InsnID]-&gt;getOperand(OpIdx);
       if (!MO.isReg() ||
-          MRI.getType(MO.getReg()) != ExecInfo.TypeObjects[TypeID]) {
+          MRI.getType(MO.getReg()) != getTypeFromIdx(TypeID)) {
         if (handleReject() == RejectAndGiveUp)
           return false;
       }
@@ -671,6 +698,25 @@ bool GIMatchTableExecutor::executeMatchTable(
       State.RecordedOperands[StoreIdx] = &amp;State.MIs[InsnID]-&gt;getOperand(OpIdx);
       break;
     }
+    case GIM_RecordRegType: {
+      int64_t InsnID = MatchTable[CurrentIdx++];
+      int64_t OpIdx = MatchTable[CurrentIdx++];
+      int64_t TypeIdx = MatchTable[CurrentIdx++];
+
+      DEBUG_WITH_TYPE(TgtExecutor::getName(),
+                      dbgs() &lt;&lt; CurrentIdx &lt;&lt; &quot;: GIM_RecordRegType(MIs[&quot;
+                             &lt;&lt; InsnID &lt;&lt; &quot;]-&gt;getOperand(&quot; &lt;&lt; OpIdx
+                             &lt;&lt; &quot;), TypeIdx=&quot; &lt;&lt; TypeIdx &lt;&lt; &quot;)\n&quot;);
+      assert(State.MIs[InsnID] != nullptr &amp;&amp; &quot;Used insn before defined&quot;);
+      assert(TypeIdx &lt;= 0 &amp;&amp; &quot;Temp types always have negative indexes!&quot;);
+      // Indexes start at -1.
+      TypeIdx = 1 - TypeIdx;
+      const auto&amp; Op = State.MIs[InsnID]-&gt;getOperand(OpIdx);
+      if(State.RecordedTypes.size() &lt;= (uint64_t)TypeIdx)
+        State.RecordedTypes.resize(TypeIdx + 1, LLT());
+      State.RecordedTypes[TypeIdx] = MRI.getType(Op.getReg());
+      break;
+    }
     case GIM_CheckRegBankForClass: {
       int64_t InsnID = MatchTable[CurrentIdx++];
       int64_t OpIdx = MatchTable[CurrentIdx++];
@@ -901,6 +947,7 @@ bool GIMatchTableExecutor::executeMatchTable(
       OutMIs[NewInsnID] = MachineInstrBuilder(*State.MIs[OldInsnID]-&gt;getMF(),
                                               State.MIs[OldInsnID]);
       OutMIs[NewInsnID]-&gt;setDesc(TII.get(NewOpcode));
+      MTObserver.CreatedInsts.insert(OutMIs[NewInsnID]);
       DEBUG_WITH_TYPE(TgtExecutor::getName(),
                       dbgs() &lt;&lt; CurrentIdx &lt;&lt; &quot;: GIR_MutateOpcode(OutMIs[&quot;
                              &lt;&lt; NewInsnID &lt;&lt; &quot;], MIs[&quot; &lt;&lt; OldInsnID &lt;&lt; &quot;], &quot;
@@ -914,14 +961,23 @@ bool GIMatchTableExecutor::executeMatchTable(
       if (NewInsnID &gt;= OutMIs.size())
         OutMIs.resize(NewInsnID + 1);
 
-      OutMIs[NewInsnID] = BuildMI(*State.MIs[0]-&gt;getParent(), State.MIs[0],
-                                  MIMetadata(*State.MIs[0]), TII.get(Opcode));
+      OutMIs[NewInsnID] = Builder.buildInstr(Opcode);
       DEBUG_WITH_TYPE(TgtExecutor::getName(),
                       dbgs() &lt;&lt; CurrentIdx &lt;&lt; &quot;: GIR_BuildMI(OutMIs[&quot;
                              &lt;&lt; NewInsnID &lt;&lt; &quot;], &quot; &lt;&lt; Opcode &lt;&lt; &quot;)\n&quot;);
       break;
     }
 
+    case GIR_BuildConstant: {
+      int64_t TempRegID = MatchTable[CurrentIdx++];
+      int64_t Imm = MatchTable[CurrentIdx++];
+      Builder.buildConstant(State.TempRegisters[TempRegID], Imm);
+      DEBUG_WITH_TYPE(TgtExecutor::getName(),
+                      dbgs() &lt;&lt; CurrentIdx &lt;&lt; &quot;: GIR_BuildConstant(TempReg[&quot;
+                             &lt;&lt; TempRegID &lt;&lt; &quot;], Imm=&quot; &lt;&lt; Imm &lt;&lt; &quot;)\n&quot;);
+      break;
+    }
+
     case GIR_Copy: {
       int64_t NewInsnID = MatchTable[CurrentIdx++];
       int64_t OldInsnID = MatchTable[CurrentIdx++];
@@ -1047,24 +1103,6 @@ bool GIMatchTableExecutor::executeMatchTable(
                              &lt;&lt; &quot;], &quot; &lt;&lt; Imm &lt;&lt; &quot;)\n&quot;);
       break;
     }
-
-    case GIR_AddCImm: {
-      int64_t InsnID = MatchTable[CurrentIdx++];
-      int64_t TypeID = MatchTable[CurrentIdx++];
-      int64_t Imm = MatchTable[CurrentIdx++];
-      assert(OutMIs[InsnID] &amp;&amp; &quot;Attempted to add to undefined instruction&quot;);
-
-      unsigned Width = ExecInfo.TypeObjects[TypeID].getScalarSizeInBits();
-      LLVMContext &amp;Ctx = MF-&gt;getFunction().getContext();
-      OutMIs[InsnID].addCImm(
-          ConstantInt::get(IntegerType::get(Ctx, Width), Imm, /*signed*/ true));
-      DEBUG_WITH_TYPE(TgtExecutor::getName(),
-                      dbgs() &lt;&lt; CurrentIdx &lt;&lt; &quot;: GIR_AddCImm(OutMIs[&quot; &lt;&lt; InsnID
-                             &lt;&lt; &quot;],...
<truncated>
</pre>
</details>


https://github.com/llvm/llvm-project/pull/66377


More information about the llvm-commits mailing list