[Mlir-commits] [mlir] [MLIR][Python] Support Python-defined rewrite patterns (PR #162699)

Maksim Levental llvmlistbot at llvm.org
Fri Oct 10 10:59:02 PDT 2025


================
@@ -332,6 +333,86 @@ MlirRewriterBase mlirPatternRewriterAsBase(MlirPatternRewriter rewriter) {
   return wrap(static_cast<mlir::RewriterBase *>(unwrap(rewriter)));
 }
 
+//===----------------------------------------------------------------------===//
+/// RewritePattern API
+//===----------------------------------------------------------------------===//
+
+inline const mlir::RewritePattern *unwrap(MlirRewritePattern pattern) {
+  assert(pattern.ptr && "unexpected null pattern");
----------------
makslevental wrote:

```suggestion
  assert(pattern.ptr && "expected non-null pattern");
```

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


More information about the Mlir-commits mailing list