[Mlir-commits] [mlir] 998e8f4 - [MLIR][CAPI] Fix duplicate output from mlirOperationPrintWithState (#174047)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Jan 1 20:18:30 PST 2026


Author: Friedrich Schöller
Date: 2026-01-01T20:18:26-08:00
New Revision: 998e8f48655fac704d66c030f42dc57d072e98be

URL: https://github.com/llvm/llvm-project/commit/998e8f48655fac704d66c030f42dc57d072e98be
DIFF: https://github.com/llvm/llvm-project/commit/998e8f48655fac704d66c030f42dc57d072e98be.diff

LOG: [MLIR][CAPI] Fix duplicate output from mlirOperationPrintWithState (#174047)

Fixes an issue where, when supplied with an `MlirAsmState`,
`mlirOperationPrintWithState` prints the output twice, once with and
once without using the state.

Added: 
    

Modified: 
    mlir/lib/CAPI/IR/IR.cpp

Removed: 
    


################################################################################
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