[Mlir-commits] [mlir] [mlir] Add dialect hooks for registering custom type and attribute alias printers (PR #173091)

Mehdi Amini llvmlistbot at llvm.org
Mon Dec 22 10:19:22 PST 2025


joker-eph wrote:

> Could you elaborate in the pitfalls? So far you've only mentioned about being misleading when a someone reads the IR.

The textual IR faithfully representing the in-memory IR is a big one already. Reading `!dialect.foo` and having a non `foo` entity seems like breaking an invariant right now.

Otherwise as Jacques mentioned, suddenly the printed IR depends on the dialects that are loaded, that means that printing the same IR before or after running a pass-pipeline (on an unrelated IR) would change the printing.

It's also not clear to me if your chaining of callbacks provides a unambiguous resolution of the printing right now: the ordering in which dialects are loaded could then impact the printed IR.


> We already allow text sugaring to hide bits of the internal state. For example, we don't always print attr_segment_sizes.

I don't quite see the relationship though.


https://github.com/llvm/llvm-project/pull/173091


More information about the Mlir-commits mailing list