[Mlir-commits] [mlir] [mlir] Add support for DIGlobalVariable and DIGlobalVariableExpression (PR #73367)

Christian Ulmann llvmlistbot at llvm.org
Wed Nov 29 00:53:43 PST 2023


================
@@ -263,3 +265,25 @@ llvm.func @dbg_intrinsics_with_no_location(%arg0: i32) -> (i32) {
   llvm.intr.dbg.label #di_label
   llvm.return %arg0 : i32
 }
+
+// -----
+
+// CHECK: @global_with_expr_1 = external global i64, !dbg !0
+// CHECK: @global_with_expr_2 = external global i64, !dbg !5
+// CHECK: !llvm.module.flags = !{!8}
+// CHECK: !llvm.dbg.cu = !{!2}
+// CHECK: !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
+// CHECK: !1 = distinct !DIGlobalVariable(name: "global_with_expr_1", scope: !2, file: !3, line: 370, type: !7, isLocal: false, isDefinition: false)
+// CHECK: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "MLIR", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !4)
+// CHECK: !3 = !DIFile(filename: "not", directory: "existence")
+// CHECK: !4 = !{!0, !5}
+// CHECK: !5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
+// CHECK: !6 = distinct !DIGlobalVariable(name: "global_with_expr_2", linkageName: "global_with_expr_2", scope: !2, file: !3, line: 371, type: !7, isLocal: true, isDefinition: true, align: 8)
+// CHECK: !7 = !DIBasicType(name: "uint64_t", size: 64, encoding: DW_ATE_unsigned)
+// CHECK: !8 = !{i32 2, !"Debug Info Version", i32 3}
+
+#di_file_2 = #llvm.di_file<"not" in "existence">
+#di_compile_unit_2 = #llvm.di_compile_unit<sourceLanguage = DW_LANG_C, file = #di_file_2, producer = "MLIR", isOptimized = true, emissionKind = Full>
+#di_basic_type_2 = #llvm.di_basic_type<tag = DW_TAG_base_type, name = "uint64_t", sizeInBits = 64, encoding = DW_ATE_unsigned>
+llvm.mlir.global external @global_with_expr_1() {addr_space = 0 : i32, dbg_expr = #llvm.di_global_variable_expression<var = <scope = #di_compile_unit_2, name = "global_with_expr_1", file = #di_file_2, line = 370, type = #di_basic_type_2>, expr = <>>} : i64
+llvm.mlir.global external @global_with_expr_2() {addr_space = 0 : i32, dbg_expr = #llvm.di_global_variable_expression<var = <scope = #di_compile_unit_2, name = "global_with_expr_2", linkageName = "global_with_expr_2", file = #di_file_2, line = 371, type = #di_basic_type_2, isLocalToUnit = true, isDefined = true, alignInBits = 8>, expr = <>>} : i64
----------------
Dinistro wrote:

Nit: Missing newline.

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


More information about the Mlir-commits mailing list