[Mlir-commits] [mlir] [mlir] Fix non-termination when a block becomes unreachable during rewriting (PR #221152)

Matthias Springer llvmlistbot at llvm.org
Sat Sep 5 09:03:02 PDT 2026


================
@@ -482,6 +482,15 @@ bool GreedyPatternRewriteDriver::processWorklist() {
       }
     });
 
+    // Folding an operation that uses its own result can loop forever, so
+    // skip it. Such operations are legal in unreachable code.
----------------
matthias-springer wrote:

Note: Such operations can even be legal in reachable code (graph regions). Excluding them from a greedy pattern rewrite seems like working around the issue.

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


More information about the Mlir-commits mailing list