xref: /llvm-project/llvm/test/DebugInfo/Inputs/gmlt.ll (revision 1c2d3338eb8a280fc49eef143f502c5f44f72e4c)
1; Generated from the following source compiled with clang++ -gmlt:
2; void f1() {}
3; void __attribute__((section("__TEXT,__bar"))) f2() {}
4; void __attribute__((always_inline)) f3() { f1(); }
5; void f4() { f3(); }
6
7; Check that
8;  * -gmlt includes no DW_TAG_subprograms for subprograms without inlined
9;    subroutines.
10;  * yet still produces DW_AT_ranges and a range list in debug_ranges that
11;    describes those subprograms
12
13; CHECK: DW_TAG_compile_unit
14; CHECK:   DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
15; CHECK-NOT: {{DW_TAG|NULL}}
16
17; Omitting the subprograms without inlined subroutines is not possible
18; currently on Darwin as dsymutil will drop the whole CU if it has no subprograms
19; (which happens with this optimization if there are no inlined subroutines).
20
21; DARWIN:  DW_TAG_subprogram
22; DARWIN-NOT: DW_TAG
23; DARWIN:    DW_AT_name {{.*}} "f1"
24; DARWIN-NOT: {{DW_TAG|NULL}}
25; DARWIN:  DW_TAG_subprogram
26; DARWIN-NOT: DW_TAG
27; DARWIN:    DW_AT_name {{.*}} "f2"
28; DARWIN-NOT: {{DW_TAG|NULL}}
29; DARWIN:  DW_TAG_subprogram
30; DARWIN-NOT: DW_TAG
31; Can't check the abstract_origin value across the DARWIN/CHECK checking and
32; ordering, so don't bother - just trust me, it refers to f3 down there.
33; DARWIN:    DW_AT_abstract_origin
34; DARWIN-NOT: {{DW_TAG|NULL}}
35
36
37; FIXME: Emitting separate abstract definitions is inefficient when we could
38; just attach the DW_AT_name to the inlined_subroutine directly. Except that
39; would produce many string relocations. Implement string indexing in the
40; skeleton CU to address the relocation problem, then remove abstract
41; definitions from -gmlt here.
42
43; CHECK: DW_TAG_subprogram
44; CHECK-NEXT:     DW_AT_name {{.*}}"f3"
45; CHECK-NEXT:     DW_AT_inline
46
47; Check that we only provide the minimal attributes on a subprogram to save space.
48; CHECK:   DW_TAG_subprogram
49; CHECK-NEXT:     DW_AT_low_pc
50; CHECK-NEXT:     DW_AT_high_pc
51; CHECK-NEXT:     DW_AT_name
52; CHECK-NOT: {{DW_TAG|DW_AT}}
53; CHECK:     DW_TAG_inlined_subroutine
54
55; As mentioned above - replace DW_AT_abstract_origin with DW_AT_name to save
56; space once we have support for string indexing in non-dwo sections
57
58; CHECK-NEXT:       DW_AT_abstract_origin {{.*}} "f3"
59; CHECK-NEXT:       DW_AT_low_pc
60; CHECK-NEXT:       DW_AT_high_pc
61; CHECK-NEXT:       DW_AT_call_file
62; CHECK-NEXT:       DW_AT_call_line
63; CHECK-NEXT:       DW_AT_call_column
64
65; Make sure we don't have any other subprograms here (subprograms with no
66; inlined subroutines are omitted by design to save space)
67
68; CHECK-NOT: {{DW_TAG|DW_AT}}
69; CHECK: NULL
70; CHECK-NOT: {{DW_TAG|DW_AT}}
71; CHECK: NULL
72
73; CHECK: .debug_ranges contents:
74
75; ... some addresses (depends on platform (such as platforms with function
76; reordering in the linker), and looks wonky on platforms with zero values
77; written in relocation places (dumper needs to	be fixed to read the
78; relocations rather than interpret that as the end of a range list))
79
80; CHECK: 00000000 <End of list>
81
82
83; Check that we don't emit any pubnames or pubtypes under -gmlt
84; CHECK-NOT: .debug_pubnames contents:
85; CHECK-NOT: .debug_pubtypes contents:
86
87; Function Attrs: nounwind uwtable
88define void @_Z2f1v() #0 !dbg !4 {
89entry:
90  ret void, !dbg !13
91}
92
93; Function Attrs: nounwind uwtable
94define void @_Z2f2v() #0 section "__TEXT,__bar" !dbg !7 {
95entry:
96  ret void, !dbg !14
97}
98
99; Function Attrs: alwaysinline nounwind uwtable
100define void @_Z2f3v() #1 !dbg !8 {
101entry:
102  call void @_Z2f1v(), !dbg !15
103  ret void, !dbg !16
104}
105
106; Function Attrs: nounwind uwtable
107define void @_Z2f4v() #0 !dbg !9 {
108entry:
109  call void @_Z2f1v() #2, !dbg !17
110  ret void, !dbg !19
111}
112
113attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
114attributes #1 = { alwaysinline nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
115attributes #2 = { nounwind }
116
117!llvm.dbg.cu = !{!0}
118!llvm.module.flags = !{!10, !11}
119!llvm.ident = !{!12}
120
121!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 ", isOptimized: false, emissionKind: LineTablesOnly, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
122!1 = !DIFile(filename: "gmlt.cpp", directory: "/tmp/dbginfo")
123!2 = !{}
124!4 = distinct !DISubprogram(name: "f1", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !2)
125!5 = !DIFile(filename: "gmlt.cpp", directory: "/tmp/dbginfo")
126!6 = !DISubroutineType(types: !2)
127!7 = distinct !DISubprogram(name: "f2", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 2, file: !1, scope: !5, type: !6, retainedNodes: !2)
128!8 = distinct !DISubprogram(name: "f3", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !1, scope: !5, type: !6, retainedNodes: !2)
129!9 = distinct !DISubprogram(name: "f4", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 4, file: !1, scope: !5, type: !6, retainedNodes: !2)
130!10 = !{i32 2, !"Dwarf Version", i32 4}
131!11 = !{i32 2, !"Debug Info Version", i32 3}
132!12 = !{!"clang version 3.6.0 "}
133!13 = !DILocation(line: 1, column: 12, scope: !4)
134!14 = !DILocation(line: 2, column: 53, scope: !7)
135!15 = !DILocation(line: 3, column: 44, scope: !8)
136!16 = !DILocation(line: 3, column: 50, scope: !8)
137!17 = !DILocation(line: 3, column: 44, scope: !8, inlinedAt: !18)
138!18 = !DILocation(line: 4, column: 13, scope: !9)
139!19 = !DILocation(line: 4, column: 19, scope: !9)
140