[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 03:07:07 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:

It feels a bit more complicated than the original implementation in the `apply` function, but maybe that's just because I wrote that one and I'm more familiar with it...


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


More information about the Mlir-commits mailing list