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

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 26 20:00:47 PST 2020


mehdi_amini accepted this revision.
mehdi_amini added inline comments.
This revision is now accepted and ready to land.


================
Comment at: mlir/lib/IR/AsmPrinter.cpp:162
+         *elementsAttrElementLimit <
+             int64_t(attr.isa<SplatElementsAttr>() ? 1 : attr.getNumElements());
 }
----------------
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()));
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92165



More information about the llvm-commits mailing list