Omit DW_TAG_subprograms for subprograms without inlined subroutines when producing...
[oota-llvm.git] / test / DebugInfo / gmlt.ll
1 ; REQUIRES: object-emission
2 ; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s
3
4 ; Generated from the following source compiled with clang++ -gmlt:
5 ; void f1() {}
6 ; void __attribute__((section("__TEXT,__bar"))) f2() {}
7 ; void __attribute__((always_inline)) f3() { f1(); }
8 ; void f4() { f3(); }
9
10 ; Check that
11 ;  * -gmlt includes no DW_TAG_subprograms for subprograms without inlined
12 ;    subroutines.
13 ;  * yet still produces DW_AT_ranges and a range list in debug_ranges that
14 ;    describes those subprograms
15
16 ; CHECK: DW_TAG_compile_unit
17 ; CHECK:   DW_AT_ranges [DW_FORM_sec_offset] (0x00000000)
18 ; CHECK-NOT: {{DW_TAG|NULL}}
19
20
21 ; FIXME: Emitting separate abstract definitions is inefficient when we could
22 ; just attach the DW_AT_name to the inlined_subroutine directly. Except that
23 ; would produce many string relocations. Implement string indexing in the
24 ; skeleton CU to address the relocation problem, then remove abstract
25 ; definitions from -gmlt here.
26
27 ; CHECK: [[F3_ABS_DEF:.*]]:  DW_TAG_subprogram
28 ; CHECK-NEXT:     DW_AT_name {{.*}} "f3"
29
30 ; FIXME: We don't really need DW_AT_inline, consumers can ignore this due to
31 ; the absence of high_pc/low_pc/ranges and know that they just need it for
32 ; retrieving the name of a concrete inlined instance
33
34 ; CHECK-NEXT:     DW_AT_inline
35 ; CHECK-NOT: {{DW_TAG|DW_AT|NULL}}
36
37 ; Check that we only provide the minimal attributes on a subprogram to save space.
38 ; CHECK:   DW_TAG_subprogram
39 ; CHECK-NEXT:     DW_AT_low_pc
40 ; CHECK-NEXT:     DW_AT_high_pc
41 ; CHECK-NEXT:     DW_AT_name
42 ; CHECK-NOT: {{DW_TAG|DW_AT}}
43 ; CHECK:     DW_TAG_inlined_subroutine
44
45 ; As mentioned above - replace DW_AT_abstract_origin with DW_AT_name to save
46 ; space once we have support for string indexing in non-dwo sections
47
48 ; CHECK-NEXT:       DW_AT_abstract_origin {{.*}} {[[F3_ABS_DEF]]}
49 ; CHECK-NEXT:       DW_AT_low_pc
50 ; CHECK-NEXT:       DW_AT_high_pc
51 ; CHECK-NEXT:       DW_AT_call_file
52 ; CHECK-NEXT:       DW_AT_call_line
53
54 ; Make sure we don't have any other subprograms here (subprograms with no
55 ; inlined subroutines are omitted by design to save space)
56
57 ; CHECK-NOT: {{DW_TAG|DW_AT}}
58 ; CHECK: NULL
59 ; CHECK-NOT: {{DW_TAG|DW_AT}}
60 ; CHECK: NULL
61
62
63 ; FIXME: llvm-dwarfdump should detect the relocations here and realize that the
64 ; first two "end of list" are really just unrelocated values describing the two
65 ; functions in the CU.
66 ; CHECK: .debug_ranges contents:
67 ; CHECK: 00000000 <End of list>
68 ; CHECK: 00000010 <End of list>
69 ; CHECK: 00000020 <End of list>
70
71 ; Check that we don't emit any pubnames or pubtypes under -gmlt
72 ; CHECK: .debug_pubnames contents:
73 ; CHECK-NOT: Offset
74
75 ; CHECK: .debug_pubtypes contents:
76 ; CHECK-NOT: Offset
77
78 ; Function Attrs: nounwind uwtable
79 define void @_Z2f1v() #0 {
80 entry:
81   ret void, !dbg !13
82 }
83
84 ; Function Attrs: nounwind uwtable
85 define void @_Z2f2v() #0 section "__TEXT,__bar" {
86 entry:
87   ret void, !dbg !14
88 }
89
90 ; Function Attrs: alwaysinline nounwind uwtable
91 define void @_Z2f3v() #1 {
92 entry:
93   call void @_Z2f1v(), !dbg !15
94   ret void, !dbg !16
95 }
96
97 ; Function Attrs: nounwind uwtable
98 define void @_Z2f4v() #0 {
99 entry:
100   call void @_Z2f1v() #2, !dbg !17
101   ret void, !dbg !19
102 }
103
104 attributes #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" }
105 attributes #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" }
106 attributes #2 = { nounwind }
107
108 !llvm.dbg.cu = !{!0}
109 !llvm.module.flags = !{!10, !11}
110 !llvm.ident = !{!12}
111
112 !0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.6.0 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !"", i32 2} ; [ DW_TAG_compile_unit ] [/tmp/dbginfo/gmlt.cpp] [DW_LANG_C_plus_plus]
113 !1 = metadata !{metadata !"gmlt.cpp", metadata !"/tmp/dbginfo"}
114 !2 = metadata !{}
115 !3 = metadata !{metadata !4, metadata !7, metadata !8, metadata !9}
116 !4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"f1", metadata !"f1", metadata !"", i32 1, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @_Z2f1v, null, null, metadata !2, i32 1} ; [ DW_TAG_subprogram ] [line 1] [def] [f1]
117 !5 = metadata !{i32 786473, metadata !1}          ; [ DW_TAG_file_type ] [/tmp/dbginfo/gmlt.cpp]
118 !6 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !2, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
119 !7 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"f2", metadata !"f2", metadata !"", i32 2, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @_Z2f2v, null, null, metadata !2, i32 2} ; [ DW_TAG_subprogram ] [line 2] [def] [f2]
120 !8 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"f3", metadata !"f3", metadata !"", i32 3, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @_Z2f3v, null, null, metadata !2, i32 3} ; [ DW_TAG_subprogram ] [line 3] [def] [f3]
121 !9 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"f4", metadata !"f4", metadata !"", i32 4, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @_Z2f4v, null, null, metadata !2, i32 4} ; [ DW_TAG_subprogram ] [line 4] [def] [f4]
122 !10 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
123 !11 = metadata !{i32 2, metadata !"Debug Info Version", i32 1}
124 !12 = metadata !{metadata !"clang version 3.6.0 "}
125 !13 = metadata !{i32 1, i32 12, metadata !4, null}
126 !14 = metadata !{i32 2, i32 53, metadata !7, null}
127 !15 = metadata !{i32 3, i32 44, metadata !8, null}
128 !16 = metadata !{i32 3, i32 50, metadata !8, null}
129 !17 = metadata !{i32 3, i32 44, metadata !8, metadata !18}
130 !18 = metadata !{i32 4, i32 13, metadata !9, null}
131 !19 = metadata !{i32 4, i32 19, metadata !9, null}