aboutsummaryrefslogtreecommitdiff
path: root/mlir/test
diff options
context:
space:
mode:
authorBilly Zhu <billyzhu@modular.com>2023-12-05 02:05:21 -0800
committerGitHub <noreply@github.com>2023-12-05 11:05:21 +0100
commitfd870c6fa987869abc9c7fa4a59037088ac71636 (patch)
tree9d3aa999f4dd57b937c379ae0a4f9c4ee10ba341 /mlir/test
parent6b8d659062a0f9a7daa641432701dc6996939dc5 (diff)
downloadllvm-fd870c6fa987869abc9c7fa4a59037088ac71636.zip
llvm-fd870c6fa987869abc9c7fa4a59037088ac71636.tar.gz
llvm-fd870c6fa987869abc9c7fa4a59037088ac71636.tar.bz2
[MLIR][LLVM] Translate Debug EmissionKind (#74376)
Translate debug emission kind into LLVM (the importer already supports this).
Diffstat (limited to 'mlir/test')
-rw-r--r--mlir/test/Target/LLVMIR/llvmir-debug.mlir21
1 files changed, 21 insertions, 0 deletions
diff --git a/mlir/test/Target/LLVMIR/llvmir-debug.mlir b/mlir/test/Target/LLVMIR/llvmir-debug.mlir
index e62ee35..74e657e 100644
--- a/mlir/test/Target/LLVMIR/llvmir-debug.mlir
+++ b/mlir/test/Target/LLVMIR/llvmir-debug.mlir
@@ -286,3 +286,24 @@ llvm.func @dbg_intrinsics_with_no_location(%arg0: i32) -> (i32) {
#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", linkageName = "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
+
+// -----
+
+// CHECK-DAG: ![[FILE1:.*]] = !DIFile(filename: "foo1.mlir", directory: "/test/")
+#di_file_1 = #llvm.di_file<"foo1.mlir" in "/test/">
+// CHECK-DAG: ![[FILE2:.*]] = !DIFile(filename: "foo2.mlir", directory: "/test/")
+#di_file_2 = #llvm.di_file<"foo2.mlir" in "/test/">
+// CHECK-DAG: ![[SCOPE2:.*]] = distinct !DICompileUnit(language: DW_LANG_C, file: ![[FILE2]], producer: "MLIR", isOptimized: true, runtimeVersion: 0, emissionKind: DebugDirectivesOnly)
+#di_compile_unit_1 = #llvm.di_compile_unit<sourceLanguage = DW_LANG_C, file = #di_file_1, producer = "MLIR", isOptimized = true, emissionKind = LineTablesOnly>
+// CHECK-DAG: ![[SCOPE1:.*]] = distinct !DICompileUnit(language: DW_LANG_C, file: ![[FILE1]], producer: "MLIR", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly)
+#di_compile_unit_2 = #llvm.di_compile_unit<sourceLanguage = DW_LANG_C, file = #di_file_2, producer = "MLIR", isOptimized = true, emissionKind = DebugDirectivesOnly>
+#di_subprogram_1 = #llvm.di_subprogram<compileUnit = #di_compile_unit_1, scope = #di_file_1, name = "func1", file = #di_file_1, subprogramFlags = "Definition|Optimized">
+#di_subprogram_2 = #llvm.di_subprogram<compileUnit = #di_compile_unit_2, scope = #di_file_2, name = "func2", file = #di_file_2, subprogramFlags = "Definition|Optimized">
+
+llvm.func @func_line_tables() {
+ llvm.return
+} loc(fused<#di_subprogram_1>["foo1.mlir":0:0])
+
+llvm.func @func_debug_directives() {
+ llvm.return
+} loc(fused<#di_subprogram_2>["foo2.mlir":0:0])