[Mlir-commits] [mlir] [MLIR][CAPI] Fix duplicate output from mlirOperationPrintWithState (PR #174047)
Friedrich Schöller
llvmlistbot at llvm.org
Tue Dec 30 17:02:38 PST 2025
https://github.com/friedrich created https://github.com/llvm/llvm-project/pull/174047
Fixes an issue where, when supplied with an `MlirAsmState`, `mlirOperationPrintWithState` prints the output twice, once with and once without using the state.
@ftynse @jpienaar @joker-eph
>From 38928184e0c63836d85d721a3a9cd4a7c3a4d863 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Friedrich=20Sch=C3=B6ller?=
<friedrich.schoeller at spacelike.ai>
Date: Wed, 31 Dec 2025 00:58:30 +0100
Subject: [PATCH] [MLIR][CAPI] Fix duplicate output from
mlirOperationPrintWithState
---
mlir/lib/CAPI/IR/IR.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mlir/lib/CAPI/IR/IR.cpp b/mlir/lib/CAPI/IR/IR.cpp
index 21d51c64a8802..09666932004a4 100644
--- a/mlir/lib/CAPI/IR/IR.cpp
+++ b/mlir/lib/CAPI/IR/IR.cpp
@@ -835,7 +835,8 @@ void mlirOperationPrintWithState(MlirOperation op, MlirAsmState state,
detail::CallbackOstream stream(callback, userData);
if (state.ptr)
unwrap(op)->print(stream, *unwrap(state));
- unwrap(op)->print(stream);
+ else
+ unwrap(op)->print(stream);
}
void mlirOperationWriteBytecode(MlirOperation op, MlirStringCallback callback,
More information about the Mlir-commits
mailing list