diff --git a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td --- a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td +++ b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td @@ -203,10 +203,14 @@ OptionalAttr:$illegal_dialects, UnitAttr:$partialConversion); let results = (outs); - let regions = (region VariadicRegion>:$regions); + let regions = (region + MaxSizedRegion<1>:$patterns, + VariadicRegion>:$default_type_converter_region); let assemblyFormat = [{ - `to` $target $regions attr-dict `:` type($target) + `to` $target $patterns + (`with` `type_converter` $default_type_converter_region^)? + attr-dict `:` type($target) }]; let hasVerifier = 1; @@ -221,15 +225,11 @@ ]; let extraClassDeclaration = [{ - ::mlir::Region &getPatterns() { - return getRegion(0); - } - ::mlir::transform::TypeConverterBuilderOpInterface getDefaultTypeConverter() { - if (getNumRegions() < 2) + if (getDefaultTypeConverterRegion().size() == 0) return {}; return ::llvm::cast<::mlir::transform::TypeConverterBuilderOpInterface>( - &getRegion(1).front().front()); + &getDefaultTypeConverterRegion()[0].front().front()); } }]; } diff --git a/mlir/test/Dialect/Transform/test-pattern-application.mlir b/mlir/test/Dialect/Transform/test-pattern-application.mlir --- a/mlir/test/Dialect/Transform/test-pattern-application.mlir +++ b/mlir/test/Dialect/Transform/test-pattern-application.mlir @@ -248,7 +248,7 @@ %0 = transform.structured.match ops{["func.func"]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.apply_conversion_patterns to %0 { transform.apply_conversion_patterns.transform.test_conversion_patterns - }, { + } with type_converter { transform.apply_conversion_patterns.transform.test_type_converter } {illegal_ops = ["test.foo"], legal_ops = ["func.func", "func.return", "test.new_op"]} @@ -263,7 +263,7 @@ // expected-error @below{{conversion target is not specified}} transform.apply_conversion_patterns to %0 { transform.apply_conversion_patterns.transform.test_conversion_patterns - }, { + } with type_converter { transform.apply_conversion_patterns.transform.test_type_converter } : !transform.any_op }