44// CHECK: llvm.return loc(#loc
55// CHECK: loc(#loc[[LOC:[0-9]+]])
66// CHECK: #di_file = #llvm.di_file<"<unknown>" in "">
7- // CHECK: #di_subprogram = #llvm.di_subprogram<compileUnit = #di_compile_unit, scope = #di_file, name = "func_no_debug", linkageName = "func_no_debug", file = #di_file, line = 1, scopeLine = 1, subprogramFlags = "Definition|Optimized", type = #di_subroutine_type>
7+ // CHECK: #di_subprogram = #llvm.di_subprogram<id = distinct[{{.*}}]<>, compileUnit = #di_compile_unit, scope = #di_file, name = "func_no_debug", linkageName = "func_no_debug", file = #di_file, line = 1, scopeLine = 1, subprogramFlags = "Definition|Optimized", type = #di_subroutine_type>
88// CHECK: #loc[[LOC]] = loc(fused<#di_subprogram>
99module {
1010 llvm.func @func_no_debug () {
@@ -14,12 +14,22 @@ module {
1414
1515// -----
1616
17+ // Test that the declarations subprogram is not made distinct.
18+ // CHECK-LABEL: llvm.func @func_decl_no_debug()
19+ // CHECK: #di_subprogram = #llvm.di_subprogram<
20+ // CHECK-NOT: id = distinct
21+ module {
22+ llvm.func @func_decl_no_debug () loc (unknown )
23+ } loc (unknown )
24+
25+ // -----
26+
1727// Test that existing debug info is not overwritten.
1828// CHECK-LABEL: llvm.func @func_with_debug()
1929// CHECK: llvm.return loc(#loc
2030// CHECK: loc(#loc[[LOC:[0-9]+]])
2131// CHECK: #di_file = #llvm.di_file<"<unknown>" in "">
22- // CHECK: #di_subprogram = #llvm.di_subprogram<compileUnit = #di_compile_unit, scope = #di_file, name = "func_with_debug", linkageName = "func_with_debug", file = #di_file, line = 42, scopeLine = 42, subprogramFlags = "Definition|Optimized", type = #di_subroutine_type>
32+ // CHECK: #di_subprogram = #llvm.di_subprogram<id = distinct[{{.*}}]<>, compileUnit = #di_compile_unit, scope = #di_file, name = "func_with_debug", linkageName = "func_with_debug", file = #di_file, line = 42, scopeLine = 42, subprogramFlags = "Definition|Optimized", type = #di_subroutine_type>
2333// CHECK: #loc[[LOC]] = loc(fused<#di_subprogram>
2434module {
2535 llvm.func @func_with_debug () {
@@ -31,7 +41,7 @@ module {
3141#loc = loc (" foo" :0 :0 )
3242#loc1 = loc (unknown )
3343#di_compile_unit = #llvm.di_compile_unit <id = distinct [0 ]<>, sourceLanguage = DW_LANG_C , file = #di_file , producer = " MLIR" , isOptimized = true , emissionKind = LineTablesOnly >
34- #di_subprogram = #llvm.di_subprogram <compileUnit = #di_compile_unit , scope = #di_file , name = " func_with_debug" , linkageName = " func_with_debug" , file = #di_file , line = 42 , scopeLine = 42 , subprogramFlags = " Definition|Optimized" , type = #di_subroutine_type >
44+ #di_subprogram = #llvm.di_subprogram <id = distinct [ 1 ]<>, compileUnit = #di_compile_unit , scope = #di_file , name = " func_with_debug" , linkageName = " func_with_debug" , file = #di_file , line = 42 , scopeLine = 42 , subprogramFlags = " Definition|Optimized" , type = #di_subroutine_type >
3545#loc2 = loc (fused <#di_subprogram >[#loc1 ])
3646
3747// -----
@@ -44,8 +54,8 @@ module {
4454// CHECK-DAG: #[[DI_FILE_MODULE:.+]] = #llvm.di_file<"bar.mlir" in "baz">
4555// CHECK-DAG: #[[DI_FILE_FUNC:.+]] = #llvm.di_file<"file.mlir" in "">
4656// CHECK-DAG: #loc[[FUNCFILELOC:[0-9]+]] = loc("file.mlir":9:8)
47- // CHECK-DAG: #di_compile_unit = #llvm.di_compile_unit<id = distinct[0 ]<>, sourceLanguage = DW_LANG_C, file = #[[DI_FILE_MODULE]], producer = "MLIR", isOptimized = true, emissionKind = LineTablesOnly>
48- // CHECK-DAG: #di_subprogram = #llvm.di_subprogram<compileUnit = #di_compile_unit, scope = #[[DI_FILE_FUNC]], name = "propagate_compile_unit", linkageName = "propagate_compile_unit", file = #[[DI_FILE_FUNC]], line = 9, scopeLine = 8, subprogramFlags = "Definition|Optimized", type = #di_subroutine_type>
57+ // CHECK-DAG: #di_compile_unit = #llvm.di_compile_unit<id = distinct[{{.*}} ]<>, sourceLanguage = DW_LANG_C, file = #[[DI_FILE_MODULE]], producer = "MLIR", isOptimized = true, emissionKind = LineTablesOnly>
58+ // CHECK-DAG: #di_subprogram = #llvm.di_subprogram<id = distinct[{{.*}}]<>, compileUnit = #di_compile_unit, scope = #[[DI_FILE_FUNC]], name = "propagate_compile_unit", linkageName = "propagate_compile_unit", file = #[[DI_FILE_FUNC]], line = 9, scopeLine = 8, subprogramFlags = "Definition|Optimized", type = #di_subroutine_type>
4959// CHECK-DAG: #loc[[MODULELOC]] = loc(fused<#di_compile_unit>[#loc])
5060// CHECK-DAG: #loc[[FUNCLOC]] = loc(fused<#di_subprogram>[#loc[[FUNCFILELOC]]
5161module {
0 commit comments