diff --git a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td --- a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td +++ b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td @@ -576,17 +576,17 @@ //===----------------------------------------------------------------------===// def PDL_RewriteOp : PDL_Op<"rewrite", [ - Terminator, HasParent<"pdl::PatternOp">, - SingleBlockImplicitTerminator<"pdl::RewriteEndOp"> + Terminator, HasParent<"pdl::PatternOp">, NoTerminator, NoRegionArguments, + SingleBlock ]> { let summary = "Specify the rewrite of a matched pattern"; let description = [{ `pdl.rewrite` operations terminate the region of a `pdl.pattern` and specify the main rewrite of a `pdl.pattern`, on the specified root operation. The - rewrite is specified either via a string name (`name`) to an external + rewrite is specified either via a string name (`name`) to a native rewrite function, or via the region body. The rewrite region, if specified, - must contain a single block and terminate via the `pdl.rewrite_end` - operation. If the rewrite is external, it also takes a set of constant + must contain a single block. If the rewrite is external it functions + similarly to `pdl.apply_native_rewrite`, and takes a set of constant parameters and a set of additional positional values defined within the matcher as arguments. If the rewrite is external, the root operation is passed to the native function as the first argument. @@ -618,16 +618,6 @@ }]; } -def PDL_RewriteEndOp : PDL_Op<"rewrite_end", [Terminator, - HasParent<"pdl::RewriteOp">]> { - let summary = "Implicit terminator of a `pdl.rewrite` region"; - let description = [{ - `pdl.rewrite_end` operations terminate the region of a `pdl.rewrite`. - }]; - let assemblyFormat = "attr-dict"; - let verifier = ?; -} - //===----------------------------------------------------------------------===// // pdl::TypeOp //===----------------------------------------------------------------------===// diff --git a/mlir/test/Dialect/PDL/invalid.mlir b/mlir/test/Dialect/PDL/invalid.mlir --- a/mlir/test/Dialect/PDL/invalid.mlir +++ b/mlir/test/Dialect/PDL/invalid.mlir @@ -223,7 +223,6 @@ // expected-error@below {{expected no external arguments when the rewrite is specified inline}} "pdl.rewrite"(%op, %op) ({ ^bb1: - pdl.rewrite_end }) : (!pdl.operation, !pdl.operation) -> () } @@ -235,7 +234,6 @@ // expected-error@below {{expected no external constant parameters when the rewrite is specified inline}} "pdl.rewrite"(%op) ({ ^bb1: - pdl.rewrite_end }) {externalConstParams = []} : (!pdl.operation) -> () } @@ -247,7 +245,6 @@ // expected-error@below {{expected rewrite region to be empty when rewrite is external}} "pdl.rewrite"(%op) ({ ^bb1: - pdl.rewrite_end }) {name = "foo"} : (!pdl.operation) -> () }