[Mlir-commits] [mlir] [mlir:doc] Clarify requirements on `RewritePatterns`. (PR #218351)
Ingo Müller
llvmlistbot at llvm.org
Mon Aug 24 07:24:02 PDT 2026
================
@@ -186,7 +186,8 @@ root operation may be replaced (but not erased). It allows for updating an
operation in-place, or returning a set of pre-existing values (or attributes) to
replace the operation with. This ensures that the `fold` method is a truly
"local" transformation, and can be invoked without the need for a pattern
-rewriter.
+rewriter. As with [rewrite patterns](PatternRewriter.md#restrictions), folding
+should ideally always preserve IR verifiability.
----------------
ingomueller-net wrote:
> For folding I can't see a use case for allowing to produce invalid IR, especially because folding is very attached to the op itself and used in many context, while patterns can be assembled together to operate within the context of a specific pass.
Maybe we can write something like this instead:
```suggestion
rewriter. A folder must always preserve always preserve IR verifiability (similar
to [rewrite patterns](PatternRewriter.md#restrictions), where that property is
highly recommended).
```
https://github.com/llvm/llvm-project/pull/218351
More information about the Mlir-commits
mailing list