[PATCH] D79684: [mlir][shape] Tidy up shape.shape_of

Sean Silva via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 11 12:57:06 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb6045448869a: [mlir][shape] Tidy up shape.shape_of (authored by silvas).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79684/new/

https://reviews.llvm.org/D79684

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


Index: mlir/test/Dialect/Shape/ops.mlir
===================================================================
--- mlir/test/Dialect/Shape/ops.mlir
+++ mlir/test/Dialect/Shape/ops.mlir
@@ -62,3 +62,8 @@
   %1 = shape.const_shape [1, 2, 3]
   return
 }
+
+func @test_shape_of(%arg0: tensor<?xf32>) -> !shape.shape {
+  %0 = shape.shape_of %arg0 : tensor<?xf32>
+  return %0 : !shape.shape
+}
Index: mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
===================================================================
--- mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
+++ mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
@@ -226,12 +226,14 @@
 }
 
 def Shape_ShapeOfOp : Shape_Op<"shape_of",
-    [DeclareOpInterfaceMethods<InferTypeOpInterface>]> {
+    [NoSideEffect, DeclareOpInterfaceMethods<InferTypeOpInterface>]> {
   let summary = "Returns shape of a value or shaped type operand";
 
   let arguments = (ins AnyTypeOf<[AnyShaped, Shape_ValueShapeType]>:$arg);
   let results = (outs Shape_ShapeType:$result);
 
+  let assemblyFormat = "attr-dict $arg `:` type($arg)";
+
   let hasFolder = 1;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79684.263256.patch
Type: text/x-patch
Size: 1096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200511/d5aebde6/attachment.bin>


More information about the llvm-commits mailing list