[Mlir-commits] [mlir] Make printing Value to a stream thread-safe (PR #185762)
Mehdi Amini
llvmlistbot at llvm.org
Wed Mar 11 09:31:22 PDT 2026
================
@@ -4142,8 +4142,13 @@ void Value::print(raw_ostream &os, AsmState &state) const {
<< "' at index: " << arg.getArgNumber();
}
+raw_ostream &mlir::operator<<(raw_ostream &os, Value value) {
+ value.print(os, OpPrintingFlags().useLocalScope());
+ return os;
+}
+
void Value::dump() const {
- print(llvm::errs());
+ print(llvm::errs(), OpPrintingFlags().useLocalScope());
----------------
joker-eph wrote:
I agree that crashing is bad.
My concern is that dump() is what we call from the debugger, and it is useful to do `op->dump()` and then `op->getParentOp()->dump()` and finding your op in the larger output, which is hard with the local scope...
That said since Operation::dump() has this problem, aligning Value should be fine.
https://github.com/llvm/llvm-project/pull/185762
More information about the Mlir-commits
mailing list