<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/145695>145695</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir] prop-dict printout sometimes starts with `<{`, but sometimes with `< {`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
peledins-zimperium
</td>
</tr>
</table>
<pre>
This happens, because:
```
void OpState::genericPrintProperties(OpAsmPrinter &p, Attribute properties,
ArrayRef<StringRef> elidedProps) {
...
if (dictAttr && !elidedProps.empty()) {
...
if (atLeastOneAttr) {
p << "<";
p.printOptionalAttrDict(dictAttr.getValue(), elidedProps); // "< {" - has space
p << ">";
}
} else {
p << "<" << properties << ">"; // "<{" - no space
}
...
```
This depends on whether there are ellided properties being specified in printout or not:
In "< {" case the end result is:
```
AsmPrinter::Impl::printOptionalAttrDict
...
// Otherwise, print them all out in braces.
os << " {"; //// THE SPACE IS COMING FROM HERE
interleaveComma(filteredAttrs,
[&](NamedAttribute attr) { printNamedAttribute(attr); });
os << '}';
```
But in other case
```
void AsmPrinter::Impl::printAttributeImpl(Attribute attr,
AttrTypeElision typeElision) {
if (!isa<BuiltinDialect>(attr.getDialect())) {
...
} else if (auto dictAttr = llvm::dyn_cast<DictionaryAttr>(attr)) {
os << '{';
interleaveComma(dictAttr.getValue(),
[&](NamedAttribute attr) { printNamedAttribute(attr); });
os << '}';
```
It would be great to be consistent.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEVV2P6jgP_jXhxhpUUlrgohelwHtGes9hNDPa21XaGsgqTaLEnRH761dJ-eh8HO3lVqhYieM8th8_Fd7Lo0YsWLZm2WYiejoZV1hU2ErtH_6WnUUn-25Sm_ZcvJ6kh5OwFrVnvIIaG9F7ZGnJkpLlyeWXlG9GtrC3LyQo7qblETU62Tw5qenJGYuOJHrGl3tb-i4uowPGcxs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