[Mlir-commits] [mlir] 74d3305 - [MLIR][Shape] Add convenience builder for `shape.assuming_all`

Frederik Gossen llvmlistbot at llvm.org
Fri Apr 9 03:17:59 PDT 2021


Author: Frederik Gossen
Date: 2021-04-09T12:17:34+02:00
New Revision: 74d33052ddd2cfd06fd37159e0f3266b4be2301d

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

LOG: [MLIR][Shape] Add convenience builder for `shape.assuming_all`

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

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
    mlir/lib/Dialect/Shape/IR/Shape.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
index d2bce0ba83cc..a4000180f27d 100644
--- a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
+++ b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
@@ -748,6 +748,12 @@ def Shape_AssumingAllOp : Shape_Op<"assuming_all", [Commutative, NoSideEffect]>
   let arguments = (ins Variadic<Shape_WitnessType>:$inputs);
   let results = (outs Shape_WitnessType:$result);
 
+  // Only needed while tablegen is unable to generate this for ops with variadic
+  // arguments.
+  let builders = [
+    OpBuilder<(ins "ValueRange":$inputs)>,
+  ];
+
   let assemblyFormat = "$inputs attr-dict";
 
   let hasFolder = 1;

diff  --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp
index 31943368dbad..3fa314d74705 100644
--- a/mlir/lib/Dialect/Shape/IR/Shape.cpp
+++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp
@@ -436,6 +436,11 @@ static LogicalResult verify(AssumingAllOp op) {
   return success();
 }
 
+void AssumingAllOp::build(OpBuilder &b, OperationState &state,
+                          ValueRange inputs) {
+  build(b, state, b.getType<WitnessType>(), inputs);
+}
+
 //===----------------------------------------------------------------------===//
 // BroadcastOp
 //===----------------------------------------------------------------------===//


        


More information about the Mlir-commits mailing list