[PATCH] D92165: Don't elide splat attributes during printing

Tamas Berghammer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 27 06:42:38 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe4c74fd9ddd9: Don't elide splat attributes during printing (authored by tberghammer).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92165

Files:
  mlir/lib/IR/AsmPrinter.cpp
  mlir/test/IR/pretty-attributes.mlir


Index: mlir/test/IR/pretty-attributes.mlir
===================================================================
--- mlir/test/IR/pretty-attributes.mlir
+++ mlir/test/IR/pretty-attributes.mlir
@@ -16,3 +16,6 @@
 
 // CHECK: opaque<"", "0xDEADBEEF"> : tensor<100xf32>
 "test.opaque_attr"() {foo.opaque_attr = opaque<"", "0xEBFE"> : tensor<100xf32> } : () -> ()
+
+// CHECK: dense<1> : tensor<3xi32>
+"test.dense_splat"() {foo.dense_attr = dense<1> : tensor<3xi32>} : () -> ()
Index: mlir/lib/IR/AsmPrinter.cpp
===================================================================
--- mlir/lib/IR/AsmPrinter.cpp
+++ mlir/lib/IR/AsmPrinter.cpp
@@ -158,7 +158,8 @@
 /// Return if the given ElementsAttr should be elided.
 bool OpPrintingFlags::shouldElideElementsAttr(ElementsAttr attr) const {
   return elementsAttrElementLimit.hasValue() &&
-         *elementsAttrElementLimit < int64_t(attr.getNumElements());
+         *elementsAttrElementLimit < int64_t(attr.getNumElements()) &&
+         !attr.isa<SplatElementsAttr>();
 }
 
 /// Return the size limit for printing large ElementsAttr.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92165.308037.patch
Type: text/x-patch
Size: 1085 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201127/2761941d/attachment.bin>


More information about the llvm-commits mailing list