blob: 23118573ea0a0f722bb234effafbb4ee6ce566d0 [file] [log] [blame]
David Blaikie3a443c22014-11-04 22:12:25 +00001; RUN: llc -split-dwarf=Enable -O0 < %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj | llvm-dwarfdump -debug-dump=info - | FileCheck %s
2
3; Test the emission of gmlt-like inlining information into the skeleton unit.
4; This allows inline-aware symbolication/backtracing given only the linked
5; executable, without needing access to the .dwos.
6
7; A simple example of inlining generated with clang -gsplit-dwarf
8
9; A member function is used to force emission of the declaration of the
10; function into the .dwo file, which may be shared with other CUs in the dwo ;
11; under fission, but should not be shared with the skeleton's CU. This also
12; tests the general case of context emission, which is suppressed in gmlt-like
13; data.
14
15; Include a template just to test template parameters are not emitted in
16; gmlt-like data.
17
18; And some varargs to make sure DW_TAG_unspecified_parameters is not emitted.
19
20; And a using declaration in a nested lexical_block... because that shouldn't
21; be emitted either.
22
23; Minor complication: after generating the LLVM IR, it was manually edited so
24; that the 'f1()' call from f3 was reordered to appear between the two inlined
25; f1 calls from f2. This causes f2's inlined_subroutine to use DW_AT_ranges,
26; thus exercising range list generation/referencing which was buggy.
27
28; struct foo {
29; template<typename T>
30; static void f2();
31; static void f3(...);
32; };
33;
34; void f1();
35;
36; template<typename T>
37; inline __attribute__((always_inline)) void foo::f2() {
38; f1();
39; f1();
40; }
41;
42; void foo::f3(...) {
43; if (true) {
44; f1();
45; f2<int>();
46; using ::foo;
47; }
48; }
49
50; Check that we emit the usual gmlt-like data for this file, including brief
51; descriptions of subprograms with inlined scopes.
52
53; FIXME: Once tools support indexed addresses in the skeleton CU, we should use
54; those (DW_FORM_addr would become DW_FORM_GNU_addr_index below) since those
55; addresses will already be in the address pool anyway.
56
57; CHECK: DW_TAG_subprogram
58; CHECK-NEXT: DW_AT_name {{.*}} "f2<int>"
59; CHECK-NOT: DW_
60; CHECK: DW_TAG_subprogram
61; CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr]
62; CHECK-NEXT: DW_AT_high_pc
63; CHECK-NEXT: DW_AT_name {{.*}} "f3"
64; CHECK-NOT: {{DW_|NULL}}
65; CHECK: DW_TAG_inlined_subroutine
66; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "f2<int>"
67; CHECK-NEXT: DW_AT_ranges
68; CHECK-NEXT: DW_AT_call_file
69; CHECK-NEXT: DW_AT_call_line {{.*}} (18)
70; CHECK-NOT: DW_
71
72; Function Attrs: uwtable
73define void @_ZN3foo2f3Ez(...) #0 align 2 {
74entry:
75 call void @_Z2f1v(), !dbg !26
76 call void @_Z2f1v(), !dbg !25
77 call void @_Z2f1v(), !dbg !28
78 ret void, !dbg !29
79}
80
81declare void @_Z2f1v() #1
82
83attributes #0 = { 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" }
84attributes #1 = { "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" }
85
86!llvm.dbg.cu = !{!0}
87!llvm.module.flags = !{!22, !23}
88!llvm.ident = !{!24}
89
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000090!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 ", isOptimized: false, splitDebugFilename: "fission-inline.dwo", emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !9, globals: !2, imports: !18)
91!1 = !DIFile(filename: "fission-inline.cpp", directory: "/tmp/dbginfo")
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000092!2 = !{}
93!3 = !{!4}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000094!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 1, size: 8, align: 8, file: !1, elements: !5, identifier: "_ZTS3foo")
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000095!5 = !{!6}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000096!6 = !DISubprogram(name: "f3", linkageName: "_ZN3foo2f3Ez", line: 4, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !1, scope: !"_ZTS3foo", type: !7)
97!7 = !DISubroutineType(types: !8)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000098!8 = !{null, null}
99!9 = !{!10, !11}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000100!10 = !DISubprogram(name: "f3", linkageName: "_ZN3foo2f3Ez", line: 15, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 15, file: !1, scope: !"_ZTS3foo", type: !7, function: void (...)* @_ZN3foo2f3Ez, declaration: !6, variables: !2)
101!11 = !DISubprogram(name: "f2<int>", linkageName: "_ZN3foo2f2IiEEvv", line: 10, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 10, file: !1, scope: !"_ZTS3foo", type: !12, templateParams: !14, declaration: !17, variables: !2)
102!12 = !DISubroutineType(types: !13)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000103!13 = !{null}
104!14 = !{!15}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000105!15 = !DITemplateTypeParameter(name: "T", type: !16)
106!16 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
107!17 = !DISubprogram(name: "f2<int>", linkageName: "_ZN3foo2f2IiEEvv", line: 10, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 10, file: !1, scope: !"_ZTS3foo", type: !12, templateParams: !14)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000108!18 = !{!19}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000109!19 = !DIImportedEntity(tag: DW_TAG_imported_declaration, line: 19, scope: !20, entity: !"_ZTS3foo")
110!20 = distinct !DILexicalBlock(line: 16, column: 13, file: !1, scope: !21)
111!21 = distinct !DILexicalBlock(line: 16, column: 7, file: !1, scope: !10)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000112!22 = !{i32 2, !"Dwarf Version", i32 4}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000113!23 = !{i32 2, !"Debug Info Version", i32 3}
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000114!24 = !{!"clang version 3.6.0 "}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000115!25 = !DILocation(line: 17, column: 5, scope: !20)
116!26 = !DILocation(line: 11, column: 3, scope: !11, inlinedAt: !27)
117!27 = !DILocation(line: 18, column: 5, scope: !20)
118!28 = !DILocation(line: 12, column: 3, scope: !11, inlinedAt: !27)
119!29 = !DILocation(line: 21, column: 1, scope: !10)