[Mlir-commits] [mlir] [MLIR][CAPI] Fix duplicate output from mlirOperationPrintWithState (PR #174047)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Dec 30 17:03:26 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Friedrich Schöller (friedrich)
<details>
<summary>Changes</summary>
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
---
Full diff: https://github.com/llvm/llvm-project/pull/174047.diff
1 Files Affected:
- (modified) mlir/lib/CAPI/IR/IR.cpp (+2-1)
``````````diff
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,
``````````
</details>
https://github.com/llvm/llvm-project/pull/174047
More information about the Mlir-commits
mailing list