[Mlir-commits] [mlir] 4e19ba4 - [mlir][shape] Add assemblyFormat for `shape.add`.

Alexander Belyaev llvmlistbot at llvm.org
Thu Jun 11 09:35:23 PDT 2020


Author: Alexander Belyaev
Date: 2020-06-11T18:35:05+02:00
New Revision: 4e19ba4159f8e498863cd1edb9ecde175edd1f3a

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

LOG: [mlir][shape] Add assemblyFormat for `shape.add`.

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

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
    mlir/test/Dialect/Shape/ops.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
index 334a15ba2459..78b86bfb22aa 100644
--- a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
+++ b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
@@ -63,6 +63,8 @@ def Shape_AddOp : Shape_Op<"add", [SameOperandsAndResultType]> {
 
   let arguments = (ins Shape_SizeType:$lhs, Shape_SizeType:$rhs);
   let results = (outs Shape_SizeType:$result);
+
+  let assemblyFormat = "$lhs `,` $rhs attr-dict";
 }
 
 def Shape_BroadcastOp : Shape_Op<"broadcast", []> {

diff  --git a/mlir/test/Dialect/Shape/ops.mlir b/mlir/test/Dialect/Shape/ops.mlir
index a6668187f078..a6718c73a779 100644
--- a/mlir/test/Dialect/Shape/ops.mlir
+++ b/mlir/test/Dialect/Shape/ops.mlir
@@ -9,7 +9,7 @@ func @shape_num_elements(%shape : !shape.shape) -> !shape.size {
   %init = shape.const_size 0
   %num_elements = shape.reduce(%shape, %init) -> !shape.size {
     ^bb0(%index: index, %dim: !shape.size, %lci: !shape.size):
-      %acc = "shape.add"(%lci, %dim) : (!shape.size, !shape.size) -> !shape.size
+      %acc = shape.add %lci, %dim
       shape.yield %acc : !shape.size
   }
   return %num_elements : !shape.size


        


More information about the Mlir-commits mailing list