[Mlir-commits] [mlir] [mlir] fix a segment fault in `ConversionPatternRewriter::applySignatureConversion` (PR #82530)

Chao Chen llvmlistbot at llvm.org
Tue Feb 27 09:57:18 PST 2024


================
@@ -1464,6 +1465,35 @@ struct TestSignatureConversionUndo
   }
 };
 
+struct TestTestOneToNSignatureConversionNoConverter
+    : public OpConversionPattern<TestOneToNSignatureConversionNoConverterOp> {
+  TestTestOneToNSignatureConversionNoConverter(const TypeConverter &converter,
+                                               MLIRContext *context)
+      : OpConversionPattern<TestOneToNSignatureConversionNoConverterOp>(
+            context),
+        converter(converter) {}
+
+  LogicalResult
+  matchAndRewrite(TestOneToNSignatureConversionNoConverterOp op,
+                  OpAdaptor adaptor,
+                  ConversionPatternRewriter &rewriter) const final {
+    Region &region = op->getRegion(0);
+    Block *entry = &region.front();
+
+    // Convert the original entry arguments.
+    auto argTys = entry->getArgumentTypes();
+    mlir::OneToNTypeMapping argMap(argTys);
----------------
chencha3 wrote:

It can be only triggered in 1:N. The bug is actually not in the dialect conversion infrastructure, it is from the typeconverter, which is used by both 1:1 and 1:N type conversion. I can update the test case using OneToNOpConversionPattern if this is your concern and sounds good to you. 

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


More information about the Mlir-commits mailing list