[PATCH] D134861: [TableGen] Add `countRendererFns` to `InstructionOperandMatcher`

Pierre van Houtryve via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 29 01:16:42 PDT 2022


Pierre-vh created this revision.
Pierre-vh added reviewers: arsenm, foad.
Herald added a project: All.
Pierre-vh requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

Without it, the count of renderer functions is inaccurate and, in some
edge cases (like the patterns added in D134354 <https://reviews.llvm.org/D134354>), we can actually
go out of bounds (run out of pre-allocated renderer function spaces
in the GISel state)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134861

Files:
  llvm/test/TableGen/GlobalISelEmitter.td
  llvm/utils/TableGen/GlobalISelEmitter.cpp


Index: llvm/utils/TableGen/GlobalISelEmitter.cpp
===================================================================
--- llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -2522,6 +2522,12 @@
         return true;
     return false;
   }
+
+  /// Report the maximum number of temporary operands needed by the predicate
+  /// matcher.
+  unsigned countRendererFns() const override {
+    return InsnMatcher->countRendererFns();
+  }
 };
 
 void InstructionMatcher::optimize() {
Index: llvm/test/TableGen/GlobalISelEmitter.td
===================================================================
--- llvm/test/TableGen/GlobalISelEmitter.td
+++ llvm/test/TableGen/GlobalISelEmitter.td
@@ -84,7 +84,7 @@
 // CHECK-NEXT:  #endif // ifdef GET_GLOBALISEL_TEMPORARIES_DECL
 
 // CHECK-LABEL: #ifdef GET_GLOBALISEL_TEMPORARIES_INIT
-// CHECK-NEXT:    , State(2),
+// CHECK-NEXT:    , State(3),
 // CHECK-NEXT:    ISelInfo(TypeObjects, NumTypeObjects, FeatureBitsets, ComplexPredicateFns, CustomRenderers)
 // CHECK-NEXT:  #endif // ifdef GET_GLOBALISEL_TEMPORARIES_INIT
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134861.463788.patch
Type: text/x-patch
Size: 1102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220929/0f5a41fb/attachment.bin>


More information about the llvm-commits mailing list