[Mlir-commits] [mlir] [mlir] Refactor transform.apply_dce into a eliminateTriviallyDeadOps region-utils helper (PR #194041)

Matthias Springer llvmlistbot at llvm.org
Wed Apr 29 00:51:13 PDT 2026


================
@@ -506,6 +507,78 @@ LogicalResult mlir::runRegionDCE(RewriterBase &rewriter,
   return deleteDeadness(rewriter, regions, liveMap);
 }
 
+bool mlir::eliminateTriviallyDeadOps(RewriterBase &rewriter, Region &region,
+                                     bool includeNestedRegions) {
+  bool changed = false;
+
+  // Step 1: walk each op in reverse program order. If the op is already
----------------
matthias-springer wrote:

What's the reason for splitting this up in 2 steps instead of having a single worklist for operations from different regions?

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


More information about the Mlir-commits mailing list