[Mlir-commits] [mlir] [mlir][python] Enable python bindings for Index dialect (PR #85827)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Tue Mar 19 10:23:18 PDT 2024


================
@@ -0,0 +1,335 @@
+# RUN: %PYTHON %s | FileCheck %s
+
+from mlir.ir import *
+from mlir.dialects import index, arith
+
+
+def run(f):
+  print("\nTEST:", f.__name__)
+  f()
+
+
+# CHECK-LABEL: TEST: testConstantOp
+ at run
+def testConstantOp():
+  with Context() as ctx, Location.unknown():
+    module = Module.create()
+    with InsertionPoint(module.body):
+      a = index.ConstantOp(value=42)
+    # CHECK: %[[A:.*]] = index.constant 42
----------------
ftynse wrote:

Nit: there is no point it capturing the result of a regular expression if it is not being used, prefer `%{{.*}}` instead.

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


More information about the Mlir-commits mailing list