This is an archive of the discontinued LLVM Phabricator instance.

[DenseElementAttr] Simplify the public API for creating these.
ClosedPublic

Authored by lattner on May 11 2022, 9:33 PM.

Details

Summary

Instead of requiring the client to compute the "isSplat" bit,
compute it internally. This makes the logic more consistent
and defines away a lot of "elements.size()==1" in the clients.

This addresses Issue #55185

Diff Detail

Event Timeline

lattner created this revision.May 11 2022, 9:33 PM
Herald added a project: Restricted Project. · View Herald Transcript
lattner requested review of this revision.May 11 2022, 9:33 PM
rriddle accepted this revision.May 11 2022, 9:40 PM
rriddle added inline comments.
mlir/include/mlir/IR/BuiltinAttributes.td
240
249
257
318

This feels unrelated.

mlir/lib/IR/BuiltinAttributes.cpp
739

Please remove the trailing comment and prefer one placed before the line. This style of this file doesn't use those types of comments.

1084–1085
This revision is now accepted and ready to land.May 11 2022, 9:40 PM
lattner marked 3 inline comments as done.May 12 2022, 8:17 AM

Thank you for the review!

mlir/include/mlir/IR/BuiltinAttributes.td
318

removed.

mlir/lib/IR/BuiltinAttributes.cpp
1084–1085

Your suggestion isn't correct. I'm not a fan of "isValidRawBuffer", but this is calling it to get the "isSplat" value back out by-reference.