This is an archive of the discontinued LLVM Phabricator instance.

[mlir] ODS: require DefaultValuedAttr to be const-buildable
ClosedPublic

Authored by ftynse on Feb 7 2022, 1:27 AM.

Details

Summary

ODS provides a mechanism for defalut-valued attributes based on a wrapper
TableGen class that is recognized by mlir-tblgen. Such attributes, if not set
on the operaiton, can be construted on-the-fly in their getter given a constant
value. In order for this construction to work, the attribute specificaiton in
ODS must set the constBuilderCall field correctly. This has not been verified,
which could lead to invalid C++ code being generated by mlir-tblgen.

Closes #53588.

Diff Detail

Event Timeline

ftynse created this revision.Feb 7 2022, 1:27 AM
ftynse requested review of this revision.Feb 7 2022, 1:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 7 2022, 1:27 AM
rriddle accepted this revision.EditedFeb 7 2022, 11:33 AM

I'm assuming we don't have a great testing setup for this stuff, right? It's worth a bug to fix that.

This revision is now accepted and ready to land.Feb 7 2022, 11:33 AM
mehdi_amini accepted this revision.Feb 7 2022, 6:00 PM

We don't have any negative testing for mlir-tblgen, I suspect it even fails assertions instead of reporting user-visible errors in some cases. Filed https://github.com/llvm/llvm-project/issues/53649.