Don't elide splat attributes during printing
A splat attribute have a single element during printing so we should treat it as such when we decide if we elide it or not based on the flag intended to elide large attributes. Reviewed By: rriddle, mehdi_amini Differential Revision: https://reviews.llvm.org/D92165
This commit is contained in:
parent
0ce32a7982
commit
e4c74fd9dd
|
@ -158,7 +158,8 @@ OpPrintingFlags &OpPrintingFlags::useLocalScope() {
|
|||
/// 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.
|
||||
|
|
|
@ -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>} : () -> ()
|
||||
|
|
Loading…
Reference in New Issue