[Mlir-commits] [mlir] ddd8482 - [PDL] Remove RewriteEndOp and mark RewriteOp as NoTerminator

River Riddle llvmlistbot at llvm.org
Tue Jul 27 13:45:28 PDT 2021


Author: River Riddle
Date: 2021-07-27T20:45:10Z
New Revision: ddd84821172152592f76c2d5bf3debed436fc05e

URL: https://github.com/llvm/llvm-project/commit/ddd84821172152592f76c2d5bf3debed436fc05e
DIFF: https://github.com/llvm/llvm-project/commit/ddd84821172152592f76c2d5bf3debed436fc05e.diff

LOG: [PDL] Remove RewriteEndOp and mark RewriteOp as NoTerminator

RewriteEndOp was a fake terminator operation that is no longer needed now that blocks are not required to have terminators.

Differential Revision: https://reviews.llvm.org/D106911

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
    mlir/test/Dialect/PDL/invalid.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
index 32de9f438c005..5735e1467255d 100644
--- a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
+++ b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
@@ -576,17 +576,17 @@ def PDL_ResultsOp : PDL_Op<"results"> {
 //===----------------------------------------------------------------------===//
 
 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_RewriteOp : PDL_Op<"rewrite", [
   }];
 }
 
-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
index 009b622ef3d68..5c05e1a89d3f2 100644
--- a/mlir/test/Dialect/PDL/invalid.mlir
+++ b/mlir/test/Dialect/PDL/invalid.mlir
@@ -223,7 +223,6 @@ pdl.pattern : benefit(1) {
   // expected-error at 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 @@ pdl.pattern : benefit(1) {
   // expected-error at 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 @@ pdl.pattern : benefit(1) {
   // expected-error at below {{expected rewrite region to be empty when rewrite is external}}
   "pdl.rewrite"(%op) ({
     ^bb1:
-      pdl.rewrite_end
   }) {name = "foo"} : (!pdl.operation) -> ()
 }
 


        


More information about the Mlir-commits mailing list