[Mlir-commits] [mlir] [ViewOpGraph] Re-use `AsmState` to significantly speed-up printing. (PR #208240)
Mehdi Amini
llvmlistbot at llvm.org
Mon Jul 20 03:42:52 PDT 2026
================
@@ -448,6 +452,9 @@ class PrintOpPass : public impl::ViewOpGraphPassBase<PrintOpPass> {
/// Output stream to write DOT file to.
raw_indented_ostream os;
+ /// Re-usable assembly printer state for efficient printing. Initialized
+ /// on each pass run.
+ std::optional<AsmState> asmState;
----------------
joker-eph wrote:
I would ask instead: why are these members instead of local variables inside the runOnOperation?
It looks to me this is done to pass state around between methods. However I would rather see this implemented as a separate class than the pass: a `class OpGraphPrinter` with all the state and the pass and `runOnOperation()` being just a thin wrapper instantiating `OpGraphPrinter` and invoking it.
https://github.com/llvm/llvm-project/pull/208240
More information about the Mlir-commits
mailing list