Add a triple to test/DebugInfo/unconditional-branch.ll (PR23252)
[oota-llvm.git] / test / DebugInfo / X86 / stmt-list-multiple-compile-units.ll
1 ; RUN: llc -O0 %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t
2 ; RUN: llvm-dwarfdump %t | FileCheck %s
3 ; RUN: llc -O0 %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t -dwarf-version=3
4 ; RUN: llvm-dwarfdump %t | FileCheck %s -check-prefix=DWARF3
5 ; RUN: llc < %s -O0 -mtriple=x86_64-apple-macosx10.7 | FileCheck %s -check-prefix=ASM
6
7 ; rdar://13067005
8 ; CHECK: .debug_info contents:
9 ; CHECK: DW_TAG_compile_unit
10 ; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset]   (0x00000000)
11 ; CHECK: DW_AT_low_pc [DW_FORM_addr]            (0x0000000000000000)
12 ; CHECK: DW_AT_high_pc [DW_FORM_data4]          (0x00000010)
13 ; CHECK: DW_TAG_subprogram
14 ; CHECK: DW_AT_low_pc [DW_FORM_addr]            (0x0000000000000000)
15 ; CHECK: DW_AT_high_pc [DW_FORM_data4]          (0x00000010)
16
17 ; CHECK: DW_TAG_compile_unit
18 ; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset]   (0x0000003c)
19 ; CHECK: DW_AT_low_pc [DW_FORM_addr]            (0x0000000000000010)
20 ; CHECK: DW_AT_high_pc [DW_FORM_data4]          (0x00000009)
21 ; CHECK: DW_TAG_subprogram
22 ; CHECK: DW_AT_low_pc [DW_FORM_addr]            (0x0000000000000010)
23 ; CHECK: DW_AT_high_pc [DW_FORM_data4]          (0x00000009)
24
25
26 ; CHECK: .debug_line contents:
27 ; CHECK-NEXT: Line table prologue:
28 ; CHECK-NEXT: total_length: 0x00000038
29 ; CHECK: file_names[  1]    0 0x00000000 0x00000000 simple.c
30 ; CHECK: Line table prologue:
31 ; CHECK-NEXT: total_length: 0x00000039
32 ; CHECK: file_names[  1]    0 0x00000000 0x00000000 simple2.c
33 ; CHECK-NOT: file_names
34
35 ; DWARF3: .debug_info contents:
36 ; DWARF3: DW_TAG_compile_unit
37 ; DWARF3: DW_AT_stmt_list [DW_FORM_data4]    (0x00000000)
38
39 ; DWARF3: DW_TAG_compile_unit
40 ; DWARF3: DW_AT_stmt_list [DW_FORM_data4]   (0x0000003c)
41
42
43 ; DWARF3: .debug_line contents:
44 ; DWARF3-NEXT: Line table prologue:
45 ; DWARF3-NEXT: total_length: 0x00000038
46 ; DWARF3: file_names[  1]    0 0x00000000 0x00000000 simple.c
47 ; DWARF3: Line table prologue:
48 ; DWARF3-NEXT: total_length: 0x00000039
49 ; DWARF3: file_names[  1]    0 0x00000000 0x00000000 simple2.c
50 ; DWARF3-NOT: file_names
51
52 ; PR15408
53 ; ASM: Lcu_begin0:
54 ; ASM: Lset3 = Lline_table_start0-Lsection_line ## DW_AT_stmt_list
55 ; ASM-NEXT: .long   Lset3
56 ; ASM: Lcu_begin1:
57 ; ASM: Lset13 = Lline_table_start0-Lsection_line ## DW_AT_stmt_list
58 ; ASM-NEXT: .long   Lset13
59 define i32 @test(i32 %a) nounwind uwtable ssp {
60 entry:
61   %a.addr = alloca i32, align 4
62   store i32 %a, i32* %a.addr, align 4
63   call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !15, metadata !MDExpression()), !dbg !16
64   %0 = load i32, i32* %a.addr, align 4, !dbg !17
65   %call = call i32 @fn(i32 %0), !dbg !17
66   ret i32 %call, !dbg !17
67 }
68
69 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
70
71 define i32 @fn(i32 %a) nounwind uwtable ssp {
72 entry:
73   %a.addr = alloca i32, align 4
74   store i32 %a, i32* %a.addr, align 4
75   call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !19, metadata !MDExpression()), !dbg !20
76   %0 = load i32, i32* %a.addr, align 4, !dbg !21
77   ret i32 %0, !dbg !21
78 }
79
80 !llvm.dbg.cu = !{!0, !10}
81 !llvm.module.flags = !{!25}
82 !0 = !MDCompileUnit(language: DW_LANG_C99, producer: "clang version 3.3", isOptimized: false, emissionKind: 1, file: !23, enums: !1, retainedTypes: !1, subprograms: !3, globals: !1, imports:  !1)
83 !1 = !{}
84 !3 = !{!5}
85 !5 = !MDSubprogram(name: "test", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !23, scope: !6, type: !7, function: i32 (i32)* @test, variables: !1)
86 !6 = !MDFile(filename: "simple.c", directory: "/private/tmp")
87 !7 = !MDSubroutineType(types: !8)
88 !8 = !{!9, !9}
89 !9 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
90 !10 = !MDCompileUnit(language: DW_LANG_C99, producer: "clang version 3.3 (trunk 172862)", isOptimized: false, emissionKind: 1, file: !24, enums: !1, retainedTypes: !1, subprograms: !11, globals: !1, imports:  !1)
91 !11 = !{!13}
92 !13 = !MDSubprogram(name: "fn", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !24, scope: !14, type: !7, function: i32 (i32)* @fn, variables: !1)
93 !14 = !MDFile(filename: "simple2.c", directory: "/private/tmp")
94 !15 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 2, arg: 1, scope: !5, file: !6, type: !9)
95 !16 = !MDLocation(line: 2, scope: !5)
96 !17 = !MDLocation(line: 4, scope: !18)
97 !18 = distinct !MDLexicalBlock(line: 3, column: 0, file: !23, scope: !5)
98 !19 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 1, arg: 1, scope: !13, file: !14, type: !9)
99 !20 = !MDLocation(line: 1, scope: !13)
100 !21 = !MDLocation(line: 2, scope: !22)
101 !22 = distinct !MDLexicalBlock(line: 1, column: 0, file: !24, scope: !13)
102 !23 = !MDFile(filename: "simple.c", directory: "/private/tmp")
103 !24 = !MDFile(filename: "simple2.c", directory: "/private/tmp")
104 !25 = !{i32 1, !"Debug Info Version", i32 3}