Skip to content

Commit 768d032

Browse files
committed
Fix escaping of some attributes.
1 parent 47b9ae6 commit 768d032

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

mlir/lib/Transforms/ViewOpGraph.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,17 @@ class PrintOpPass : public impl::ViewOpGraphBase<PrintOpPass> {
194194

195195
// Always emit splat attributes.
196196
if (isa<SplatElementsAttr>(attr)) {
197-
attr.print(os);
197+
os << escapeLabelString(
198+
strFromOs([&](raw_ostream &os) { attr.print(os); }));
198199
return;
199200
}
200201

201202
// Elide "big" elements attributes.
202203
auto elements = dyn_cast<ElementsAttr>(attr);
203204
if (elements && elements.getNumElements() > largeAttrLimit) {
204205
os << std::string(elements.getShapedType().getRank(), '[') << "..."
205-
<< std::string(elements.getShapedType().getRank(), ']') << " : "
206-
<< elements.getType();
206+
<< std::string(elements.getShapedType().getRank(), ']') << " : ";
207+
emitMlirType(os, elements.getType());
207208
return;
208209
}
209210

@@ -313,7 +314,7 @@ class PrintOpPass : public impl::ViewOpGraphBase<PrintOpPass> {
313314
if (printAttrs) {
314315
os << "\\l";
315316
for (const NamedAttribute &attr : op->getAttrs()) {
316-
os << attr.getName().getValue() << ": ";
317+
os << escapeLabelString(attr.getName().getValue().str()) << ": ";
317318
emitMlirAttr(os, attr.getValue());
318319
os << "\\l";
319320
}

0 commit comments

Comments
 (0)