[Mlir-commits] [mlir] [mlir][llvmir][debug] Correctly generate location for phi nodes. (PR #105534)

Tobias Gysi llvmlistbot at llvm.org
Wed Aug 21 08:15:49 PDT 2024


================
@@ -0,0 +1,47 @@
+// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s
+
+
+module attributes {} {
+  llvm.func @test(%arg0: !llvm.ptr)  {
+    %0 = llvm.mlir.constant(1 : i64) : i64 loc(#loc2)
+    %1 = llvm.alloca %0 x i32 : (i64) -> !llvm.ptr loc(#loc2)
+    %3 = llvm.mlir.constant(100 : index) : i64 loc(#loc2)
+    %7 = llvm.trunc %0 : i64 to i32 loc(#loc2)
+    llvm.br ^bb1(%7, %3 : i32, i64) loc(#loc2)
+  ^bb1(%8: i32 loc(#loc4), %9: i64 loc(#loc5)):  // 2 preds: ^bb0, ^bb2
----------------
gysit wrote:

Can you shorten the program a bit? It seems like two constants plus a branch to a follow up block with two arguments and a return should be sufficient for the test?

The subprogram below seems also unnecessary since we do not check if it is exported correctly. I think it is fine to omit it here.

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


More information about the Mlir-commits mailing list