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

Maksim Levental llvmlistbot at llvm.org
Fri Oct 10 11:01:13 PDT 2025


================
@@ -0,0 +1,72 @@
+# RUN: %PYTHON %s 2>&1 | FileCheck %s
+
+import gc, sys
+from mlir.ir import *
+from mlir.passmanager import *
+from mlir.dialects.builtin import ModuleOp
+from mlir.dialects import arith
+from mlir.rewrite import *
+
+
+def run(f):
+    print("\nTEST:", f.__name__)
+    f()
+    gc.collect()
+    assert Context._get_live_count() == 0
----------------
makslevental wrote:

this maybe doesn't do what you think it does? it's checking for live contexts not like live ops or anything (i.e. you can probably remove this)

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


More information about the Mlir-commits mailing list