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

Matthias Springer llvmlistbot at llvm.org
Tue Feb 27 07:34:10 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);
----------------
matthias-springer wrote:

Can this bug be triggered with a 1:1 type conversion? The 1:N dialect conversion is not actually using the dialect conversion infrastructure and they may not be generally compatible.

Patterns must inherit from `OneToNOpConversionPattern` and there is a separate `applyPartialOneToNConversion` entry point.

@ingomueller-net 


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


More information about the Mlir-commits mailing list