Skip to content

Commit 72a8e79

Browse files
committed
[mlir] Improve doc in OpFormatGen.cpp (NFC)
The comment is misleading because attributes do not have `elidePrintingDefaultValue` bit. It appears that `elidePrintingDefaultValue` was never merged upstream (see: https://reviews.llvm.org/D135398 ), but the comment was likely introduced by mistake in a later revision (https://reviews.llvm.org/D135993.).
1 parent 4a7a27c commit 72a8e79

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

mlir/tools/mlir-tblgen/OpFormatGen.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,8 +2033,8 @@ static void genPropDictPrinter(OperationFormat &fmt, Operator &op,
20332033
for (const NamedAttribute *namedAttr : fmt.usedAttributes)
20342034
body << " elidedProps.push_back(\"" << namedAttr->name << "\");\n";
20352035

2036-
// Add code to check attributes for equality with the default value
2037-
// for attributes with the elidePrintingDefaultValue bit set.
2036+
// Add code to check attributes for equality with their default values.
2037+
// Default-valued attributes will not be printed when their value matches the default.
20382038
for (const NamedAttribute &namedAttr : op.getAttributes()) {
20392039
const Attribute &attr = namedAttr.attr;
20402040
if (!attr.isDerivedAttr() && attr.hasDefaultValue()) {
@@ -2080,8 +2080,9 @@ static void genAttrDictPrinter(OperationFormat &fmt, Operator &op,
20802080
body << " elidedAttrs.push_back(\"" << key << "\");\n";
20812081
for (const NamedAttribute *attr : fmt.usedAttributes)
20822082
body << " elidedAttrs.push_back(\"" << attr->name << "\");\n";
2083-
// Add code to check attributes for equality with the default value
2084-
// for attributes with the elidePrintingDefaultValue bit set.
2083+
2084+
// Add code to check attributes for equality with their default values.
2085+
// Default-valued attributes will not be printed when their value matches the default.
20852086
for (const NamedAttribute &namedAttr : op.getAttributes()) {
20862087
const Attribute &attr = namedAttr.attr;
20872088
if (!attr.isDerivedAttr() && attr.hasDefaultValue()) {

0 commit comments

Comments
 (0)