diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -381,9 +381,12 @@ // Print all of the attribute kind aliases. for (auto &kindAlias : attrKindToAlias) { auto &aliasAttrsPair = kindAlias.second; - for (unsigned i = 0, e = aliasAttrsPair.second.size(); i != e; ++i) - printAlias(aliasAttrsPair.first, aliasAttrsPair.second[i], i); - os << newLine; + unsigned size = aliasAttrsPair.second.size(); + if (size > 0) { + for (unsigned i = 0; i != size; ++i) + printAlias(aliasAttrsPair.first, aliasAttrsPair.second[i], i); + os << newLine; + } } // In a second pass print all of the remaining attribute aliases that aren't