xref: /llvm-project/llvm/test/DebugInfo/X86/fission-no-inline-gsym.ll (revision 06a0ae652497513398865d9a1b0cc3f95aa82f54)
1; RUN: llc -split-dwarf-file=%t.dwo -split-dwarf-output=%t.dwo -O0 < %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj > %t
2; RUN: llvm-gsymutil --convert=%t --out-file=%t.gsym
3; RUN: llvm-gsymutil --address=0x13 %t.gsym | FileCheck %s
4
5; Minor complication: after generating the LLVM IR, it was manually edited so
6; that the 'f1()' call from f3 was reordered to appear between the two inlined
7; f1 calls from f2. This causes f2's inlined_subroutine to use DW_AT_ranges,
8; thus exercising range list generation/referencing which was buggy.
9
10; struct foo {
11;   template<typename T>
12;   static void f2();
13;   static void f3(...);
14; };
15;
16; void f1();
17;
18; template<typename T>
19; inline __attribute__((always_inline)) void foo::f2() {
20;   f1();
21;   f1();
22; }
23;
24; void foo::f3(...) {
25;   if (true) {
26;     f1();
27;     f2<int>();
28;     using ::foo;
29;   }
30; }
31
32; Check that we parse .dwo file when creating gsym file.
33
34; CHECK:      _ZN3foo2f2IiEEvv @ fission-inline.cpp:15 [inlined]
35; CHECK-NEXT:   _ZN3foo2f3Ez + 19 @ fission-inline.cpp:21
36
37; Function Attrs: uwtable
38define void @_ZN3foo2f3Ez(...) #0 align 2 !dbg !10 {
39entry:
40  call void @_Z2f1v(), !dbg !26
41  call void @_Z2f1v(), !dbg !25
42  call void @_Z2f1v(), !dbg !28
43  call void @_Z2f1v(), !dbg !29
44  ret void, !dbg !29
45}
46
47declare void @_Z2f1v() #1
48
49attributes #0 = { 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" }
50attributes #1 = { "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" }
51
52!llvm.dbg.cu = !{!0}
53!llvm.module.flags = !{!22, !23}
54!llvm.ident = !{!24}
55
56!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 ", isOptimized: false, splitDebugFilename: "fission-inline.dwo",  emissionKind: FullDebug, splitDebugInlining: false, file: !1, enums: !2, retainedTypes: !3, globals: !2)
57!1 = !DIFile(filename: "fission-inline.cpp", directory: "")
58!2 = !{}
59!3 = !{!4}
60!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 1, size: 8, align: 8, file: !1, elements: !5, identifier: "_ZTS3foo")
61!5 = !{!6}
62!6 = !DISubprogram(name: "f3", linkageName: "_ZN3foo2f3Ez", line: 4, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !1, scope: !4, type: !7)
63!7 = !DISubroutineType(types: !8)
64!8 = !{null, null}
65!10 = distinct !DISubprogram(name: "f3", linkageName: "_ZN3foo2f3Ez", line: 15, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 15, file: !1, scope: !4, type: !7, declaration: !6, retainedNodes: !18)
66!11 = distinct !DISubprogram(name: "f2<int>", linkageName: "_ZN3foo2f2IiEEvv", line: 10, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 10, file: !1, scope: !4, type: !12, templateParams: !14, declaration: !17, retainedNodes: !2)
67!12 = !DISubroutineType(types: !13)
68!13 = !{null}
69!14 = !{!15}
70!15 = !DITemplateTypeParameter(name: "T", type: !16)
71!16 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
72!17 = !DISubprogram(name: "f2<int>", linkageName: "_ZN3foo2f2IiEEvv", line: 10, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 10, file: !1, scope: !4, type: !12, templateParams: !14)
73!18 = !{!19}
74!19 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !1, line: 19, scope: !20, entity: !4)
75!20 = distinct !DILexicalBlock(line: 16, column: 13, file: !1, scope: !21)
76!21 = distinct !DILexicalBlock(line: 16, column: 7, file: !1, scope: !10)
77!22 = !{i32 2, !"Dwarf Version", i32 4}
78!23 = !{i32 2, !"Debug Info Version", i32 3}
79!24 = !{!"clang version 3.6.0 "}
80!25 = !DILocation(line: 17, column: 5, scope: !20)
81!26 = !DILocation(line: 11, column: 3, scope: !11, inlinedAt: !27)
82!27 = !DILocation(line: 18, column: 5, scope: !20)
83!28 = !DILocation(line: 12, column: 3, scope: !11, inlinedAt: !27)
84!29 = !DILocation(line: 12, column: 3, scope: !11, inlinedAt: !30)
85!30 = !DILocation(line: 21, column: 0, scope: !10)
86