[Mlir-commits] [mlir] [mlir][Transforms][NFC] Improve debug output of `-remove-dead-values` (PR #173468)

Matthias Springer llvmlistbot at llvm.org
Wed Dec 24 01:30:46 PST 2025


================
@@ -787,13 +788,19 @@ static void cleanUpDeadVals(RDVFinalCleanupList &list) {
     // blocks that are accessed via multiple codepaths processed once
     if (b.b->getNumArguments() != b.nonLiveArgs.size())
       continue;
-    LDBG() << "Erasing " << b.nonLiveArgs.count()
-           << " non-live arguments from block: " << b.b;
-    // it iterates backwards because erase invalidates all successor indexes
+    LDBG_OS([&](raw_ostream &os) {
+      os << "Erasing non-live arguments [";
+      llvm::interleaveComma(b.nonLiveArgs.set_bits(), os);
+      os << "] from block: " << b.b << " in region "
+         << b.b->getParent()->getRegionNumber() << " of operation "
+         << b.b->getParent()->getParentOp()->getName() << " ("
+         << b.b->getParent()->getParentOp() << ")";
----------------
matthias-springer wrote:

I had it like that before but the output got difficult to read because of many verifier warnings:
```
[remove-dead-values RemoveDeadValues.cpp:884 1] Cleaning up 3 operand lists
null operand found
[mlir-asm-printer AsmPrinter.cpp:2076 1] func.func' failed to verify and will be printed in generic form
[remove-dead-values RemoveDeadValues.cpp:921 1] "scf.condition"(%2, %arg1, %arg1) {tag = "scf.condition"} : (i1, i32, i32) -> ()
```


https://github.com/llvm/llvm-project/pull/173468


More information about the Mlir-commits mailing list