[Mlir-commits] [mlir] [MLIR] Add logging to eraseUnreachableBlocks (NFC) (PR #153968)

Mehdi Amini llvmlistbot at llvm.org
Mon Aug 18 13:47:33 PDT 2025


================
@@ -182,19 +185,34 @@ SmallVector<Value> mlir::makeRegionIsolatedFromAbove(
 // TODO: We could likely merge this with the DCE algorithm below.
 LogicalResult mlir::eraseUnreachableBlocks(RewriterBase &rewriter,
                                            MutableArrayRef<Region> regions) {
+  LDBG() << "Starting eraseUnreachableBlocks with " << regions.size()
+         << " regions";
+
   // Set of blocks found to be reachable within a given region.
   llvm::df_iterator_default_set<Block *, 16> reachable;
   // If any blocks were found to be dead.
-  bool erasedDeadBlocks = false;
+  int erasedDeadBlocks = 0;
----------------
joker-eph wrote:

Instead of the API being

```
Returns success if any blocks were erased, failure otherwise.
```

We could return the number of block erased, WDYT? 

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


More information about the Mlir-commits mailing list