<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/149662>149662</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Print affine map and set evaluations in human-readable format
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mdehling
</td>
</tr>
</table>
<pre>
Affine maps and sets, by default, are printed as map/set separately, with following lists of dimension and symbol operands:
```mlir
affine.for %i = 0 to min affine_map<(d0, d1)[s0] -> (d1 floordiv s0, d0)>(%i, %j)[%k]
```
Even worse, the map may be printed separately and a reference `#mymap1` used here. This makes it very hard for a human to read the IR.
Instead, I would like to print all such evaluations in the same way as when using `printAffineMapOfSSAIds`. So the above should look like this instead:
```mlir
affine.for %i = 0 to min [%j floordiv symbol(%k), %i]
```
I understand this breaks round-tripping, but I think we could add a command line option to control this printer behavior.
Suggestion: introduce `printAffineMapEvaluation` and `printAffineSetEvaluation` and a printer flag to control behavior. With the flag set to false, both print the current format `affine_set<...>(%i, ...)[%k, ...]`, while with the flag set to true, both print the more human readable format.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVE2P6zYM_DXKhVjDluNsfPAhb7MBcihaNAV6LGSLtrWRJUMfCfLvC8rufr1eHrDAItaQHHKGFN6rwSA2rPrBquNGxDBa10wSR63MsGmtfDSHvlcGYRKzB2EkeAye8RdoHyCxF1EH-iUcwuyUCShBeEIzfvIYwOMsnAioHwS7qzBCb7W2d2UG0MoHD7YHqSY0XlmzlHhMrdVgZ3TCSM_KA8sPbJcvf5NWjuUHkXhlvXXAeKWAlUfIIViYlIHl8R-iUb4wvpc5VZcF4zWrfvicVUd4YuUr0FsBvbbWSXUDv-BywpWvjO8pNX1ivHpbghmvrqw6fmbE8sPrDQ3crfNI6DCmgcEkHtB-DOZjFqlNAQ57dGg6BMrCy-kxiblguxyiRwkjOswA_hoVTfS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