Page MenuHomePhabricator

Don't elide splat attributes during printing
ClosedPublic

Authored by tberghammer on Nov 26 2020, 3:09 AM.

Details

Summary

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.

Diff Detail

Event Timeline

tberghammer created this revision.Nov 26 2020, 3:09 AM
tberghammer requested review of this revision.Nov 26 2020, 3:09 AM
mehdi_amini accepted this revision.Nov 26 2020, 8:00 PM
mehdi_amini added inline comments.
mlir/lib/IR/AsmPrinter.cpp
162

I think this expression isn't the most straightforward way to express the logic here, in general ternary aren't great but as subexpression it is rarely a good idea IMO. I rather read something like this:

return attr.isa<SplatElementsAttr>() ||
          (elementsAttrElementLimit.hasValue() &&
         *elementsAttrElementLimit < int64_t(attr.getNumElements()));
This revision is now accepted and ready to land.Nov 26 2020, 8:00 PM
tberghammer marked an inline comment as done.

Improve readability based on review commens

rriddle accepted this revision.Nov 27 2020, 4:19 AM

Thanks!

This revision was automatically updated to reflect the committed changes.