[Mlir-commits] [mlir] Enable printing newlines and indents in attribute and type printers (PR #87948)

Ɓukasz Mielicki llvmlistbot at llvm.org
Mon Jun 10 01:46:40 PDT 2024


lmielick wrote:

> To address my concerns, I think you'd need to have the control be contextual to the operation.

@joker-eph I read the attribute is printed either with or without newlines depending on the parent operation?
Could you share an use-cese which breaks without such provision?

In the proposal it's the attribute printer's implementation choice and it is transparent to the parent operation, even if the operation uses newlines semantically the parsing composes (operation parser won't see attribute line breaks).
Making attribute printer behavior context dependent seems a bit unwieldy, especially if given attribute uses newlines semantically. We would need to take that into account in attribute printers themselves. Ignoring printNewline/increaseIndent on the attribute depending on context does not seem right.

If we need a context specific escape hatch, perhaps an option to disable pretty printers on the operation level would be the way to go?

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


More information about the Mlir-commits mailing list