[Mlir-commits] [mlir] 6b4ce5f - [PDL] Fix the builders for OperationOp and PatternOp

River Riddle llvmlistbot at llvm.org
Tue Jul 27 17:07:56 PDT 2021


Author: River Riddle
Date: 2021-07-27T23:59:14Z
New Revision: 6b4ce5fd52e03dc2a5dcf0930353c021a48605bb

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

LOG: [PDL] Fix the builders for OperationOp and PatternOp

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
    mlir/lib/Dialect/PDL/IR/PDL.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
index 5735e1467255d..832cc461da2aa 100644
--- a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
+++ b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
@@ -383,7 +383,7 @@ def PDL_OperationOp
       CArg<"ArrayRef<StringRef>", "llvm::None">:$attrNames,
       CArg<"ValueRange", "llvm::None">:$attrValues,
       CArg<"ValueRange", "llvm::None">:$resultTypes), [{
-      auto nameAttr = name ? StringAttr() : $_builder.getStringAttr(*name);
+      auto nameAttr = name ? $_builder.getStringAttr(*name) : StringAttr();
       build($_builder, $_state, $_builder.getType<OperationType>(), nameAttr,
             operandValues, attrValues, $_builder.getStrArrayAttr(attrNames),
             resultTypes);

diff  --git a/mlir/lib/Dialect/PDL/IR/PDL.cpp b/mlir/lib/Dialect/PDL/IR/PDL.cpp
index 3cb5b1bd0d082..39c25c31f1526 100644
--- a/mlir/lib/Dialect/PDL/IR/PDL.cpp
+++ b/mlir/lib/Dialect/PDL/IR/PDL.cpp
@@ -286,7 +286,7 @@ void PatternOp::build(OpBuilder &builder, OperationState &state,
         rootKind ? builder.getStringAttr(*rootKind) : StringAttr(),
         builder.getI16IntegerAttr(benefit ? *benefit : 0),
         name ? builder.getStringAttr(*name) : StringAttr());
-  builder.createBlock(state.addRegion());
+  state.regions[0]->emplaceBlock();
 }
 
 /// Returns the rewrite operation of this pattern.


        


More information about the Mlir-commits mailing list