[Mlir-commits] [mlir] [mlir][Transforms] Add dead code elimination pass (PR #106258)

Matthias Springer llvmlistbot at llvm.org
Wed Aug 28 11:44:46 PDT 2024


================
@@ -93,6 +93,20 @@ def CSE : Pass<"cse"> {
   ];
 }
 
+def DeadCodeElimination : Pass<"dce"> {
+  let summary = "Remove dead operations and blocks";
+  let description = [{
+    This pass eliminates dead operations and blocks.
+
+    Operations are eliminated if they have no users and no side effects. Blocks
+    are eliminated if they are not reachable.
+
+    Note: Graph regions are currently not supported and skipped by this pass.
----------------
matthias-springer wrote:

I think graph regions require a worklist based approach. The purpose of the commit was to provide a very fast DCE pass, so ideally I'd not maintain a worklist if there are only SSA dominance regions. (A simple walk would suffice then.) Let me try to replace the walk with a custom IR traversal...


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


More information about the Mlir-commits mailing list