[Mlir-commits] [mlir] [MLIR] Auto generate source location for python bindings (PR #112923)
Matthias Springer
llvmlistbot at llvm.org
Fri Oct 18 08:40:11 PDT 2024
================
@@ -150,3 +151,32 @@ def testLocationCapsule():
run(testLocationCapsule)
+
+
+
+# CHECK-LABEL: TEST: autoGeneratedLocation
+def autoGeneratedLocation():
+ def generator() :
+ return arith.ConstantOp(value=123, result=IntegerType.get_signless(32))
+ with Context() as ctx, Location.unknown():
+ module = Module.create()
+ with InsertionPoint(module.body):
+ a = arith.ConstantOp(value=42, result=IntegerType.get_signless(32))
+ b = arith.AddIOp(a, generator())
+ module.operation.print(enable_debug_info=True)
+
+#CHECK: module {
+#CHECK: %{{.*}} = arith.constant 42 : i32 loc(#loc4)
+#CHECK: %{{.*}} = arith.constant 123 : i32 loc(#loc5)
+#CHECK: %{{.*}} = arith.addi %{{.*}}, %{{.*}} : i32 loc(#loc6)
+#CHECK: } loc(#loc)
+
+#CHECK: #loc = loc(unknown)
+#CHECK: #loc1 = loc({{.*}}:164:0)
+#CHECK: #loc2 = loc({{.*}}:160:0)
+#CHECK: #loc3 = loc({{.*}}:165:0)
+#CHECK: #loc4 = loc("autoGeneratedLocation"(#loc1))
+#CHECK: #loc5 = loc("generator"(#loc2))
+#CHECK: #loc6 = loc("autoGeneratedLocation"(#loc3))
+
+run(autoGeneratedLocation)
----------------
matthias-springer wrote:
nit: new line
https://github.com/llvm/llvm-project/pull/112923
More information about the Mlir-commits
mailing list