[Mlir-commits] [mlir] [mlir][python] fix value builders (PR #68764)

Maksim Levental llvmlistbot at llvm.org
Tue Oct 10 22:52:44 PDT 2023


================
@@ -33,3 +33,16 @@ def testFastMathFlags():
             )
             # CHECK: %0 = arith.addf %cst, %cst fastmath<nnan,ninf> : f32
             print(r)
+
+
+# CHECK-LABEL: TEST: testArithValueBuilder
+ at run
+def testArithValueBuilder():
+    with Context() as ctx, Location.unknown():
+        module = Module.create()
+        f32_t = F32Type.get()
+
+        with InsertionPoint(module.body):
+            a = arith.constant(value=FloatAttr.get(f32_t, 42.42))
----------------
makslevental wrote:

`arith.constant` has an "ext" so this will call the base rather than the mixin builder.

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


More information about the Mlir-commits mailing list