1 ; RUN: llc -O0 -filetype=obj -o - %s | llvm-dwarfdump -v - | FileCheck %s
3 ; CHECK: .debug_info contents:
5 ; CHECK-NEXT: DW_AT_name [DW_FORM_strp] {{.*}}"top"
6 ; CHECK-NEXT: DW_AT_decl_file [DW_FORM_data1] {{.*}}debug-label.c
7 ; CHECK-NEXT: DW_AT_decl_line [DW_FORM_data1] {{.*}}4
8 ; CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] {{.*}}{{0x[0-9a-f]+}}
10 ; CHECK-NEXT: DW_AT_name [DW_FORM_strp] {{.*}}"done"
11 ; CHECK-NEXT: DW_AT_decl_file [DW_FORM_data1] {{.*}}debug-label.c
12 ; CHECK-NEXT: DW_AT_decl_line [DW_FORM_data1] {{.*}}7
13 ; CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] {{.*}}{{0x[0-9a-f]+}}
14 ; CHECK-NOT: DW_AT_name [DW_FORM_strp] {{.*}}"top"
16 ; RUN: llc -O0 -o - %s | FileCheck %s -check-prefix=ASM
18 ; ASM: [[TOP_LOW_PC:[.0-9a-zA-Z]+]]:{{[[:space:]].*}}DEBUG_LABEL: foo:top
19 ; ASM: [[DONE_LOW_PC:[.0-9a-zA-Z]+]]:{{[[:space:]].*}}DEBUG_LABEL: foo:done
20 ; ASM-LABEL: debug_info
22 ; ASM-NEXT: DW_AT_name
23 ; ASM-NEXT: 1 {{.*}} DW_AT_decl_file
24 ; ASM-NEXT: 4 {{.*}} DW_AT_decl_line
25 ; ASM-NEXT: [[TOP_LOW_PC]]{{.*}} DW_AT_low_pc
27 ; ASM-NEXT: DW_AT_name
28 ; ASM-NEXT: 1 {{.*}} DW_AT_decl_file
29 ; ASM-NEXT: 7 {{.*}} DW_AT_decl_line
30 ; ASM-NEXT: [[DONE_LOW_PC]]{{.*}} DW_AT_low_pc
32 source_filename = "debug-label.c"
34 define dso_local i32 @foo(i32 %a, i32 %b) !dbg !6 {
36 %a.addr = alloca i32, align 4
37 %b.addr = alloca i32, align 4
38 %sum = alloca i32, align 4
39 store i32 %a, i32* %a.addr, align 4
40 store i32 %b, i32* %b.addr, align 4
44 call void @llvm.dbg.label(metadata !10), !dbg !11
45 %0 = load i32, i32* %a.addr, align 4
46 %1 = load i32, i32* %b.addr, align 4
47 %add = add nsw i32 %0, %1
48 store i32 %add, i32* %sum, align 4
52 call void @llvm.dbg.label(metadata !12), !dbg !13
53 %2 = load i32, i32* %sum, align 4
57 declare void @llvm.dbg.label(metadata)
60 !llvm.module.flags = !{!4}
62 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, emissionKind: FullDebug, enums: !2)
63 !1 = !DIFile(filename: "debug-label.c", directory: "./")
66 !4 = !{i32 2, !"Debug Info Version", i32 3}
67 !6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0, retainedNodes: !3)
68 !7 = !DISubroutineType(types: !8)
70 !9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
71 !10 = !DILabel(scope: !6, name: "top", file: !1, line: 4)
72 !11 = !DILocation(line: 4, column: 1, scope: !6)
73 !12 = !DILabel(scope: !15, name: "done", file: !1, line: 7)
74 !13 = !DILocation(line: 7, column: 1, scope: !6)
75 !14 = !DILocation(line: 8, column: 3, scope: !6)
76 !15 = !DILexicalBlockFile(discriminator: 2, file: !1, scope: !6)