Skip to content

Commit 0e505d0

Browse files
committed
[mlir][tblgen] Migrate tests to properties for attributes, fix remove*Attr()
The only in-tree user of `bit usePropertiesForAttributes = 0;` was a series of tests for the output of -gen-op-{decls,defs}. This commit updates those tests to match the rest of the repository. In the short term, this is intended to enable testing upcoming updates to collective builders. In the long term, this is a step in the removal of usePropertiesForAttributes = 0. One side effect of these tests updates was the realization that the autogenerated implementations of removeFooAttr() were not returning the value of the removed attribute. This issue has been addressed and the tests have been updated to reflect the change. This is the only functionality change in this PR.
1 parent d222488 commit 0e505d0

File tree

6 files changed

+75
-87
lines changed

6 files changed

+75
-87
lines changed

mlir/test/mlir-tblgen/constraint-unique.td

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ include "mlir/IR/OpBase.td"
44

55
def Test_Dialect : Dialect {
66
let name = "test";
7-
let usePropertiesForAttributes = 0;
87
}
98

109
class NS_Op<string mnemonic, list<Trait> traits = []> :
@@ -117,8 +116,8 @@ def OpC : NS_Op<"op_c"> {
117116
// CHECK-NEXT: << "failed to verify constraint: another region";
118117

119118
/// Test that the uniqued constraints are being used.
120-
// CHECK-LABEL: OpA::verify
121-
// CHECK: ::mlir::Attribute [[$B_ATTR:.*b]];
119+
// CHECK-LABEL: OpA::verifyInvariantsImpl
120+
// CHECK: auto [[$B_ATTR:.*b]] = getProperties().b;
122121
// CHECK: if (::mlir::failed([[$A_ATTR_CONSTRAINT]](*this, [[$B_ATTR]], "b")))
123122
// CHECK-NEXT: return ::mlir::failure();
124123
// CHECK: auto [[$A_VALUE_GROUP:.*]] = getODSOperands(0);
@@ -138,8 +137,8 @@ def OpC : NS_Op<"op_c"> {
138137

139138
/// Test that the op with the same predicates but different with descriptions
140139
/// uses the different constraints.
141-
// CHECK-LABEL: OpC::verify
142-
// CHECK: ::mlir::Attribute [[$B_ATTR:.*b]];
140+
// CHECK-LABEL: OpC::verifyInvariantsImpl
141+
// CHECK: auto [[$B_ATTR:.*b]] = getProperties().b;
143142
// CHECK: if (::mlir::failed([[$O_ATTR_CONSTRAINT]](*this, [[$B_ATTR]], "b")))
144143
// CHECK-NEXT: return ::mlir::failure();
145144
// CHECK: auto [[$A_VALUE_GROUP:.*]] = getODSOperands(0);

mlir/test/mlir-tblgen/op-attribute.td

Lines changed: 57 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ include "mlir/IR/OpBase.td"
99
def Test_Dialect : Dialect {
1010
let name = "test";
1111
let cppNamespace = "foobar";
12-
let usePropertiesForAttributes = 0;
1312
}
1413
class NS_Op<string mnemonic, list<Trait> traits> :
1514
Op<Test_Dialect, mnemonic, traits>;
@@ -69,23 +68,12 @@ def AOp : NS_Op<"a_op", []> {
6968
// ---
7069

7170
// DEF: ::llvm::LogicalResult AOpAdaptor::verify
72-
// DEF: ::mlir::Attribute tblgen_aAttr;
73-
// DEF: while (true) {
74-
// DEF-NEXT: if (namedAttrIt == namedAttrRange.end())
75-
// DEF-NEXT: return emitError(loc, "'test.a_op' op ""requires attribute 'aAttr'");
76-
// DEF-NEXT: if (namedAttrIt->getName() == AOp::getAAttrAttrName(*odsOpName)) {
77-
// DEF-NEXT: tblgen_aAttr = namedAttrIt->getValue();
78-
// DEF-NEXT: break;
79-
// DEF: ::mlir::Attribute tblgen_bAttr;
80-
// DEF-NEXT: ::mlir::Attribute tblgen_cAttr;
81-
// DEF-NEXT: ::mlir::Attribute tblgen_dAttr;
82-
// DEF-NEXT: while (true) {
83-
// DEF-NEXT: if (namedAttrIt == namedAttrRange.end())
84-
// DEF-NEXT: break;
85-
// DEF: if (namedAttrIt->getName() == AOp::getBAttrAttrName(*odsOpName))
86-
// DEF-NEXT: tblgen_bAttr = namedAttrIt->getValue();
87-
// DEF: if (namedAttrIt->getName() == AOp::getCAttrAttrName(*odsOpName))
88-
// DEF-NEXT: tblgen_cAttr = namedAttrIt->getValue();
71+
// DEF-NEXT: auto tblgen_aAttr = getProperties().aAttr; (void)tblgen_aAttr;
72+
// DEF-NEXT: if (!tblgen_aAttr) return emitError(loc, "'test.a_op' op ""requires attribute 'aAttr'");
73+
// DEF-NEXT: auto tblgen_bAttr = getProperties().bAttr; (void)tblgen_bAttr;
74+
// DEF-NEXT: auto tblgen_cAttr = getProperties().cAttr; (void)tblgen_cAttr;
75+
// DEF-NEXT: auto tblgen_dAttr = getProperties().dAttr; (void)tblgen_dAttr;
76+
8977
// DEF: if (tblgen_aAttr && !((some-condition)))
9078
// DEF-NEXT: return emitError(loc, "'test.a_op' op ""attribute 'aAttr' failed to satisfy constraint: some attribute kind");
9179
// DEF: if (tblgen_bAttr && !((some-condition)))
@@ -99,25 +87,25 @@ def AOp : NS_Op<"a_op", []> {
9987
// ---
10088

10189
// DECL: some-attr-kind getAAttrAttr()
102-
// DECL-NEXT: ::llvm::cast<some-attr-kind>(::mlir::impl::getAttrFromSortedRange((*this)->getAttrs().begin() + 0, (*this)->getAttrs().end() - 0, getAAttrAttrName()))
90+
// DECL-NEXT: ::llvm::cast<some-attr-kind>(getProperties().aAttr)
10391
// DEF: some-return-type AOp::getAAttr() {
10492
// DEF-NEXT: auto attr = getAAttrAttr()
10593
// DEF-NEXT: return attr.some-convert-from-storage();
10694

10795
// DECL: some-attr-kind getBAttrAttr()
108-
// DECL-NEXT: ::llvm::dyn_cast_or_null<some-attr-kind>(::mlir::impl::getAttrFromSortedRange((*this)->getAttrs().begin() + 1, (*this)->getAttrs().end() - 0, getBAttrAttrName()))
96+
// DECL-NEXT: ::llvm::dyn_cast_or_null<some-attr-kind>(getProperties().bAttr)
10997
// DEF: some-return-type AOp::getBAttr() {
11098
// DEF-NEXT: auto attr = getBAttrAttr();
11199
// DEF-NEXT: return attr.some-convert-from-storage();
112100

113101
// DECL: some-attr-kind getCAttrAttr()
114-
// DECL-NEXT: ::llvm::dyn_cast_or_null<some-attr-kind>(::mlir::impl::getAttrFromSortedRange((*this)->getAttrs().begin() + 1, (*this)->getAttrs().end() - 0, getCAttrAttrName()))
102+
// DECL-NEXT: ::llvm::dyn_cast_or_null<some-attr-kind>(getProperties().cAttr)
115103
// DEF: ::std::optional<some-return-type> AOp::getCAttr() {
116104
// DEF-NEXT: auto attr = getCAttrAttr()
117105
// DEF-NEXT: return attr ? ::std::optional<some-return-type>(attr.some-convert-from-storage()) : (::std::nullopt);
118106

119107
// DECL: some-attr-kind getDAttrAttr()
120-
// DECL-NEXT: ::llvm::dyn_cast_or_null<some-attr-kind>(::mlir::impl::getAttrFromSortedRange((*this)->getAttrs().begin() + 1, (*this)->getAttrs().end() - 0, getDAttrAttrName()))
108+
// DECL-NEXT: ::llvm::dyn_cast_or_null<some-attr-kind>(getProperties().dAttr)
121109
// DEF: some-return-type AOp::getDAttr() {
122110
// DEF-NEXT: auto attr = getDAttrAttr();
123111
// DEF-NEXT: if (!attr)
@@ -128,59 +116,62 @@ def AOp : NS_Op<"a_op", []> {
128116
// ---
129117

130118
// DECL: void setAAttrAttr(some-attr-kind attr) {
131-
// DECL-NEXT: (*this)->setAttr(getAAttrAttrName(), attr);
119+
// DECL-NEXT: getProperties().aAttr = attr;
132120
// DEF: void AOp::setAAttr(some-return-type attrValue) {
133-
// DEF-NEXT: (*this)->setAttr(getAAttrAttrName(), some-const-builder-call(::mlir::Builder((*this)->getContext()), attrValue));
121+
// DEF-NEXT: getProperties().aAttr = some-const-builder-call(::mlir::Builder((*this)->getContext()), attrValue);
134122
// DECL: void setBAttrAttr(some-attr-kind attr) {
135-
// DECL-NEXT: (*this)->setAttr(getBAttrAttrName(), attr);
123+
// DECL-NEXT: getProperties().bAttr = attr;
136124
// DEF: void AOp::setBAttr(some-return-type attrValue) {
137-
// DEF-NEXT: (*this)->setAttr(getBAttrAttrName(), some-const-builder-call(::mlir::Builder((*this)->getContext()), attrValue));
125+
// DEF-NEXT: getProperties().bAttr = some-const-builder-call(::mlir::Builder((*this)->getContext()), attrValue);
138126
// DECL: void setCAttrAttr(some-attr-kind attr) {
139-
// DECL-NEXT: (*this)->setAttr(getCAttrAttrName(), attr);
127+
// DECL-NEXT: getProperties().cAttr = attr;
140128
// DEF: void AOp::setCAttr(::std::optional<some-return-type> attrValue) {
129+
// DEF-NEXT: auto &odsProp = getProperties().cAttr;
141130
// DEF-NEXT: if (attrValue)
142-
// DEF-NEXT: return (*this)->setAttr(getCAttrAttrName(), some-const-builder-call(::mlir::Builder((*this)->getContext()), *attrValue));
143-
// DEF-NEXT: (*this)->removeAttr(getCAttrAttrName());
131+
// DEF-NEXT: odsProp = some-const-builder-call(::mlir::Builder((*this)->getContext()), *attrValue);
132+
// DEF-NEXT: else
133+
// DEF-NEXT: odsProp = nullptr;
144134

145135
// Test remove methods
146136
// ---
147137

148138
// DECL: ::mlir::Attribute removeCAttrAttr() {
149-
// DECL-NEXT: return (*this)->removeAttr(getCAttrAttrName());
139+
// DECL-NEXT: auto attr = getProperties().cAttr;
140+
// DECL-NEXT: getProperties().cAttr = {};
141+
// DECL-NEXT: return attr;
150142

151143
// Test build methods
152144
// ---
153145

154146
// DEF: void AOp::build(
155-
// DEF: odsState.addAttribute(getAAttrAttrName(odsState.name), aAttr);
156-
// DEF: odsState.addAttribute(getBAttrAttrName(odsState.name), bAttr);
147+
// DEF: odsState.getOrAddProperties<Properties>().aAttr = aAttr;
148+
// DEF: odsState.getOrAddProperties<Properties>().bAttr = bAttr;
157149
// DEF: if (cAttr) {
158-
// DEF-NEXT: odsState.addAttribute(getCAttrAttrName(odsState.name), cAttr);
150+
// DEF-NEXT: odsState.getOrAddProperties<Properties>().cAttr = cAttr;
159151

160-
// DEF: odsState.addAttribute(getAAttrAttrName(odsState.name), some-const-builder-call(odsBuilder, aAttr));
161-
// DEF-NEXT: odsState.addAttribute(getBAttrAttrName(odsState.name), some-const-builder-call(odsBuilder, bAttr));
152+
// DEF: odsState.getOrAddProperties<Properties>().aAttr = some-const-builder-call(odsBuilder, aAttr);
153+
// DEF-NEXT: odsState.getOrAddProperties<Properties>().bAttr = some-const-builder-call(odsBuilder, bAttr);
162154
// DEF-NEXT: if (cAttr) {
163-
// DEF-NEXT: odsState.addAttribute(getCAttrAttrName(odsState.name), cAttr);
155+
// DEF-NEXT: odsState.getOrAddProperties<Properties>().cAttr = cAttr;
164156
// DEF-NEXT: }
165157
// DEF-NOT: if (dAttr)
166-
// DEF: odsState.addAttribute(getDAttrAttrName(odsState.name), some-const-builder-call(odsBuilder, dAttr));
158+
// DEF: odsState.getOrAddProperties<Properties>().dAttr = some-const-builder-call(odsBuilder, dAttr);
167159

168160
// DEF: void AOp::build(
169161
// DEF: some-return-type aAttr, some-return-type bAttr, /*optional*/some-attr-kind cAttr
170-
// DEF: odsState.addAttribute(getAAttrAttrName(odsState.name), some-const-builder-call(odsBuilder, aAttr));
162+
// DEF: odsState.getOrAddProperties<Properties>().aAttr = some-const-builder-call(odsBuilder, aAttr);
171163

172164
// DEF: void AOp::build(
173165
// DEF: ::llvm::ArrayRef<::mlir::NamedAttribute> attributes
174166
// DEF: odsState.addAttributes(attributes);
175167

176-
// DEF: void AOp::populateDefaultAttrs
168+
// DEF: void AOp::populateDefaultProperties
177169

178170
// Test the above but with prefix.
179171

180172
def Test2_Dialect : Dialect {
181173
let name = "test2";
182174
let cppNamespace = "foobar2";
183-
let usePropertiesForAttributes = 0;
184175
}
185176
def AgetOp : Op<Test2_Dialect, "a_get_op", []> {
186177
let arguments = (ins
@@ -221,13 +212,10 @@ def AgetOp : Op<Test2_Dialect, "a_get_op", []> {
221212
// ---
222213

223214
// DEF: ::llvm::LogicalResult AgetOpAdaptor::verify
224-
// DEF: ::mlir::Attribute tblgen_aAttr;
225-
// DEF: while (true)
226-
// DEF: ::mlir::Attribute tblgen_bAttr;
227-
// DEF-NEXT: ::mlir::Attribute tblgen_cAttr;
228-
// DEF: while (true)
229-
// DEF: if (tblgen_aAttr && !((some-condition)))
230-
// DEF-NEXT: return emitError(loc, "'test2.a_get_op' op ""attribute 'aAttr' failed to satisfy constraint: some attribute kind");
215+
// DEF: auto tblgen_aAttr = getProperties().aAttr; (void)tblgen_aAttr;
216+
// DEF: if (!tblgen_aAttr) return emitError(loc, "'test2.a_get_op' op ""requires attribute 'aAttr'");
217+
// DEF: auto tblgen_bAttr = getProperties().bAttr; (void)tblgen_bAttr;
218+
// DEF: auto tblgen_cAttr = getProperties().cAttr; (void)tblgen_cAttr;
231219
// DEF: if (tblgen_bAttr && !((some-condition)))
232220
// DEF-NEXT: return emitError(loc, "'test2.a_get_op' op ""attribute 'bAttr' failed to satisfy constraint: some attribute kind");
233221
// DEF: if (tblgen_cAttr && !((some-condition)))
@@ -237,21 +225,21 @@ def AgetOp : Op<Test2_Dialect, "a_get_op", []> {
237225
// ---
238226

239227
// DECL: some-attr-kind getAAttrAttr()
240-
// DECL-NEXT: ::llvm::cast<some-attr-kind>(::mlir::impl::getAttrFromSortedRange({{.*}}))
228+
// DECL-NEXT: ::llvm::cast<some-attr-kind>(getProperties().aAttr)
241229
// DEF: some-return-type AgetOp::getAAttr() {
242230
// DEF-NEXT: auto attr = getAAttrAttr()
243231
// DEF-NEXT: return attr.some-convert-from-storage();
244232

245233
// DECL: some-attr-kind getBAttrAttr()
246-
// DECL-NEXT: return ::llvm::dyn_cast_or_null<some-attr-kind>(::mlir::impl::getAttrFromSortedRange({{.*}}))
234+
// DECL-NEXT: return ::llvm::dyn_cast_or_null<some-attr-kind>(getProperties().bAttr)
247235
// DEF: some-return-type AgetOp::getBAttr() {
248236
// DEF-NEXT: auto attr = getBAttrAttr();
249237
// DEF-NEXT: if (!attr)
250238
// DEF-NEXT: return some-const-builder-call(::mlir::Builder((*this)->getContext()), 4.2).some-convert-from-storage();
251239
// DEF-NEXT: return attr.some-convert-from-storage();
252240

253241
// DECL: some-attr-kind getCAttrAttr()
254-
// DECL-NEXT: return ::llvm::dyn_cast_or_null<some-attr-kind>(::mlir::impl::getAttrFromSortedRange({{.*}}))
242+
// DECL-NEXT: return ::llvm::dyn_cast_or_null<some-attr-kind>(getProperties().cAttr)
255243
// DEF: ::std::optional<some-return-type> AgetOp::getCAttr() {
256244
// DEF-NEXT: auto attr = getCAttrAttr()
257245
// DEF-NEXT: return attr ? ::std::optional<some-return-type>(attr.some-convert-from-storage()) : (::std::nullopt);
@@ -260,30 +248,32 @@ def AgetOp : Op<Test2_Dialect, "a_get_op", []> {
260248
// ---
261249

262250
// DECL: void setAAttrAttr(some-attr-kind attr) {
263-
// DECL-NEXT: (*this)->setAttr(getAAttrAttrName(), attr);
251+
// DECL-NEXT: getProperties().aAttr = attr;
264252
// DECL: void setBAttrAttr(some-attr-kind attr) {
265-
// DECL-NEXT: (*this)->setAttr(getBAttrAttrName(), attr);
253+
// DECL-NEXT: getProperties().bAttr = attr;
266254
// DECL: void setCAttrAttr(some-attr-kind attr) {
267-
// DECL-NEXT: (*this)->setAttr(getCAttrAttrName(), attr);
255+
// DECL-NEXT: getProperties().cAttr = attr;
268256

269257
// Test remove methods
270258
// ---
271259

272260
// DECL: ::mlir::Attribute removeCAttrAttr() {
273-
// DECL-NEXT: return (*this)->removeAttr(getCAttrAttrName());
261+
// DECL-NEXT: auto attr = getProperties().cAttr;
262+
// DECL-NEXT: getProperties().cAttr = {};
263+
// DECL-NEXT: return attr;
274264

275265
// Test build methods
276266
// ---
277267

278268
// DEF: void AgetOp::build(
279-
// DEF: odsState.addAttribute(getAAttrAttrName(odsState.name), aAttr);
280-
// DEF: odsState.addAttribute(getBAttrAttrName(odsState.name), bAttr);
269+
// DEF: odsState.getOrAddProperties<Properties>().aAttr = aAttr;
270+
// DEF: odsState.getOrAddProperties<Properties>().bAttr = bAttr;
281271
// DEF: if (cAttr) {
282-
// DEF-NEXT: odsState.addAttribute(getCAttrAttrName(odsState.name), cAttr);
272+
// DEF-NEXT: odsState.getOrAddProperties<Properties>().cAttr = cAttr;
283273

284274
// DEF: void AgetOp::build(
285275
// DEF: some-return-type aAttr, /*optional*/some-return-type bAttr, /*optional*/some-attr-kind cAttr
286-
// DEF: odsState.addAttribute(getAAttrAttrName(odsState.name), some-const-builder-call(odsBuilder, aAttr));
276+
// DEF: odsState.getOrAddProperties<Properties>().aAttr = some-const-builder-call(odsBuilder, aAttr);
287277

288278
// DEF: void AgetOp::build(
289279
// DEF: ::llvm::ArrayRef<::mlir::NamedAttribute> attributes
@@ -405,8 +395,8 @@ def DOp : NS_Op<"d_op", []> {
405395
// DECL: static void build({{.*}}, uint32_t i32_attr, ::llvm::APFloat f64_attr, ::llvm::StringRef str_attr, bool bool_attr, ::SomeI32Enum enum_attr, uint32_t dv_i32_attr, ::llvm::APFloat dv_f64_attr, ::llvm::StringRef dv_str_attr = "abc", bool dv_bool_attr = true, ::SomeI32Enum dv_enum_attr = ::SomeI32Enum::case5)
406396

407397
// DEF-LABEL: DOp definitions
408-
// DEF: odsState.addAttribute(getStrAttrAttrName(odsState.name), odsBuilder.getStringAttr(str_attr));
409-
// DEF: odsState.addAttribute(getDvStrAttrAttrName(odsState.name), odsBuilder.getStringAttr(dv_str_attr));
398+
// DEF: odsState.getOrAddProperties<Properties>().str_attr = odsBuilder.getStringAttr(str_attr);
399+
// DEF: odsState.getOrAddProperties<Properties>().dv_str_attr = odsBuilder.getStringAttr(dv_str_attr);
410400

411401

412402
// Test default dictionary attribute.
@@ -420,10 +410,10 @@ def DefaultDictAttrOp : NS_Op<"default_dict_attr_op", []> {
420410
}
421411

422412
// DEF-LABEL: DefaultDictAttrOp definitions
423-
// DEF: if (!attributes.get(attrNames[0]))
424-
// DEF: attributes.append(attrNames[0], odsBuilder.getDictionaryAttr({}));
425-
// DEF: if (!attributes.get(attrNames[1]))
426-
// DEF: attributes.append(attrNames[1], odsBuilder.getDictionaryAttr(getDefaultDictAttrs(odsBuilder)));
413+
// DEF: if (!properties.empty)
414+
// DEF: properties.empty = odsBuilder.getDictionaryAttr({});
415+
// DEF: if (!properties.non_empty)
416+
// DEF: properties.non_empty = odsBuilder.getDictionaryAttr(getDefaultDictAttrs(odsBuilder));
427417

428418
// DECL-LABEL: DefaultDictAttrOp declarations
429419
// DECL: build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::DictionaryAttr empty = nullptr, ::mlir::DictionaryAttr non_empty = nullptr)
@@ -538,7 +528,9 @@ def UnitAttrOp : NS_Op<"unit_attr_op", []> {
538528

539529
// DECL-LABEL: UnitAttrOp declarations
540530
// DECL: ::mlir::Attribute removeAttrAttr() {
541-
// DECL-NEXT: (*this)->removeAttr(getAttrAttrName());
531+
// DECL-NEXT: auto attr = getProperties().attr;
532+
// DECL-NEXT: getProperties().attr = {};
533+
// DECL-NEXT: return attr;
542534
// DECL: build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/bool attr = false)
543535

544536

mlir/test/mlir-tblgen/op-decl-and-defs.td

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ include "mlir/Interfaces/SideEffectInterfaces.td"
1212
def Test_Dialect : Dialect {
1313
let name = "test";
1414
let cppNamespace = "NS";
15-
let usePropertiesForAttributes = 0;
1615
}
1716
class NS_Op<string mnemonic, list<Trait> traits> :
1817
Op<Test_Dialect, mnemonic, traits>;
@@ -58,11 +57,11 @@ def NS_AOp : NS_Op<"a_op", [IsolatedFromAbove, IsolatedFromAbove]> {
5857
// CHECK: namespace detail {
5958
// CHECK: class AOpGenericAdaptorBase {
6059
// CHECK: public:
61-
// CHECK: AOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = {}, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), odsRegions(regions)
62-
// CHECK: AOpGenericAdaptorBase(::mlir::Operation *op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), odsRegions(op->getRegions()) {}
63-
// CHECK: ::mlir::IntegerAttr getAttr1Attr();
60+
// CHECK: AOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions)
61+
// CHECK: AOpGenericAdaptorBase(AOp op);
62+
// CHECK: ::mlir::IntegerAttr getAttr1Attr() {
6463
// CHECK: uint32_t getAttr1();
65-
// CHECK: ::mlir::FloatAttr getSomeAttr2Attr();
64+
// CHECK: ::mlir::FloatAttr getSomeAttr2Attr() {
6665
// CHECK: ::std::optional< ::llvm::APFloat > getSomeAttr2();
6766
// CHECK: ::mlir::Region &getSomeRegion() {
6867
// CHECK: ::mlir::RegionRange getSomeRegions() {
@@ -72,8 +71,9 @@ def NS_AOp : NS_Op<"a_op", [IsolatedFromAbove, IsolatedFromAbove]> {
7271
// CHECK: template <typename RangeT>
7372
// CHECK: class AOpGenericAdaptor : public detail::AOpGenericAdaptorBase {
7473
// CHECK: public:
75-
// CHECK: AOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = {}, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
76-
// CHECK: AOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {}
74+
// CHECK: AOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
75+
// CHECK: AOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
76+
// CHECK: AOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AOpGenericAdaptor(values, attrs, Properties{}, {}) {}
7777
// CHECK: AOpGenericAdaptor(RangeT values, const AOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
7878
// CHECK: RangeT getODSOperands(unsigned index) {
7979
// CHECK: ValueT getA() {
@@ -88,7 +88,7 @@ def NS_AOp : NS_Op<"a_op", [IsolatedFromAbove, IsolatedFromAbove]> {
8888
// CHECK: ::llvm::LogicalResult verify(
8989
// CHECK: };
9090

91-
// CHECK: class AOp : public ::mlir::Op<AOp, ::mlir::OpTrait::AtLeastNRegions<1>::Impl, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsIsolatedFromAbove
91+
// CHECK: class AOp : public ::mlir::Op<AOp, ::mlir::OpTrait::AtLeastNRegions<1>::Impl, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove
9292
// CHECK-NOT: ::mlir::OpTrait::IsIsolatedFromAbove
9393
// CHECK: public:
9494
// CHECK: using Op::Op;
@@ -145,13 +145,12 @@ def NS_AttrSizedOperandOp : NS_Op<"attr_sized_operands",
145145
Variadic<I32>:$a,
146146
Variadic<I32>:$b,
147147
I32:$c,
148-
Variadic<I32>:$d,
149-
I32ElementsAttr:$operandSegmentSizes
148+
Variadic<I32>:$d
150149
);
151150
}
152151

153152
// CHECK-LABEL: class AttrSizedOperandOpGenericAdaptorBase {
154-
// CHECK: ::mlir::DenseIntElementsAttr getOperandSegmentSizes();
153+
// CHECK: ::llvm::ArrayRef<int32_t> getOperandSegmentSizes() const
155154

156155
// CHECK-LABEL: AttrSizedOperandOpGenericAdaptor(
157156
// CHECK-SAME: RangeT values

0 commit comments

Comments
 (0)