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