[Mlir-commits] [mlir] [MLIR][Python] Support Python-defined rewrite	patterns (PR #162699)
    llvmlistbot at llvm.org 
    llvmlistbot at llvm.org
       
    Fri Oct 10 19:55:24 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 && "expected non-null pattern");
+  return static_cast<const mlir::RewritePattern *>(pattern.ptr);
+}
+
+inline MlirRewritePattern wrap(const mlir::RewritePattern *pattern) {
+  return {pattern};
+}
----------------
PragmaTwice wrote:
Done in https://github.com/llvm/llvm-project/pull/162699/commits/65d914742acf2702aabe8188fad94ab61dcad1d6.
https://github.com/llvm/llvm-project/pull/162699
    
    
More information about the Mlir-commits
mailing list