Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/Generic/linkage-name-abstract.ll

raw
1 ; RUN: llvm-as < %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -o %t.spv
3 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll
4
5 ; RUN: llc -mtriple=%triple -O0 -filetype=obj -dwarf-linkage-names=Abstract < %t.ll | llvm-dwarfdump -v -debug-info - > %t
6 ; RUN: FileCheck %s -check-prefix=ONENAME < %t
7 ; RUN: FileCheck %s -check-prefix=REF < %t
8 ; Verify tuning for SCE gets us Abstract only.
9 ; RUN: llc -mtriple=%triple -O0 -filetype=obj -debugger-tune=sce < %t.ll | llvm-dwarfdump -v -debug-info - > %t
10 ; RUN: FileCheck %s -check-prefix=ONENAME < %t
11 ; RUN: FileCheck %s -check-prefix=REF < %t
12 ; REQUIRES: object-emission
13
14 ; Verify that the only linkage-name present is the abstract origin of the
15 ; inlined subprogram.
16
17 ; IR generated from clang -O0 with:
18 ; void f1();
19 ; __attribute__((always_inline)) void f2() {
20 ; f1();
21 ; }
22 ; void f3() {
23 ; f2();
24 ; }
25 ;
26 ; struct F4 {
27 ; __attribute__((always_inline)) void f5();
28 ; };
29 ; void F4::f5() {
30 ; f1();
31 ; }
32 ; void f6() {
33 ; F4::f5();
34 ; }
35
36 ; Show that the only linkage names are for the inlined functions,
37 ; because those are the ones with an abstract origin.
38 ; ONENAME-NOT: {{DW_AT(_MIPS)?_linkage_name}}
39 ; ONENAME: {{DW_AT(_MIPS)?_linkage_name}} {{.*}} "_Z2f2v"
40 ; ONENAME-NOT: {{DW_AT(_MIPS)?_linkage_name}}
41 ; ONENAME: {{DW_AT(_MIPS)?_linkage_name}} {{.*}} "_ZN2F42f5Ev"
42 ; ONENAME-NOT: {{DW_AT(_MIPS)?_linkage_name}}
43
44 ; For f2() we see the definition pointing to an abstract origin DIE,
45 ; which in turn is where the linkage_name is; and then there's
46 ; an inlined_subroutine pointing back to the abstract origin.
47 ; The order of these DIEs is not important of course, just the links.
48 ; REF: DW_TAG_subprogram
49 ; REF-NOT: {{DW_TAG|NULL}}
50 ; REF: DW_AT_abstract_origin {{.*}} {[[F2:0x.*]]} "_Z2f2v"
51 ; REF: [[F2]]: DW_TAG_subprogram
52 ; REF-NEXT: linkage_name {{.*}} "_Z2f2v"
53 ; REF: DW_TAG_inlined_subroutine
54 ; REF-NOT: {{DW_TAG|NULL}}
55 ; REF: DW_AT_abstract_origin {{.*}} {[[F2]]}
56
57 ; For F4::f5(), first we see the in-class declaration,
58 ; then the definition, abstract origin, and the inlined_subroutine.
59 ; REF: DW_TAG_structure_type
60 ; REF-NEXT: DW_AT_name {{.*}} "F4"
61 ; REF-NOT: {{DW_TAG|NULL}}
62 ; REF: [[F5_DECL:0x.*]]: DW_TAG_subprogram
63 ; REF-NEXT: DW_AT_name {{.*}} "f5"
64 ; REF: DW_TAG_subprogram
65 ; REF-NOT: {{DW_TAG|NULL}}
66 ; REF: DW_AT_abstract_origin {{.*}} {[[F5_ABS:0x.*]]} "_ZN2F42f5Ev"
67 ; REF: [[F5_ABS]]: DW_TAG_subprogram
68 ; REF-NOT: {{DW_TAG|NULL}}
69 ; REF: linkage_name {{.*}} "_ZN2F42f5Ev"
70 ; REF-NEXT: DW_AT_specification {{.*}} {[[F5_DECL]]}
71 ; REF: DW_TAG_inlined_subroutine
72 ; REF-NOT: {{DW_TAG|NULL}}
73 ; REF: DW_AT_abstract_origin {{.*}} {[[F5_ABS]]}
74
75 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
76 target triple = "spir64-unknown-unknown"
77
78
79 ; Function Attrs: alwaysinline uwtable
80 define void @_Z2f2v() #0 !dbg !6 {
81 entry:
82 call void @_Z2f1v(), !dbg !9
83 ret void, !dbg !10
84 }
85
86 declare void @_Z2f1v()
87
88 ; Function Attrs: uwtable
89 define void @_Z2f3v() !dbg !11 {
90 entry:
91 call void @_Z2f1v(), !dbg !12
92 ret void, !dbg !14
93 }
94
95 ; Function Attrs: alwaysinline uwtable
96 define void @_ZN2F42f5Ev() #0 align 2 !dbg !15 {
97 entry:
98 call void @_Z2f1v(), !dbg !19
99 ret void, !dbg !20
100 }
101
102 ; Function Attrs: uwtable
103 define void @_Z2f6v() !dbg !21 {
104 entry:
105 call void @_Z2f1v(), !dbg !22
106 ret void, !dbg !24
107 }
108
109 attributes #0 = { alwaysinline }
110
111 !llvm.dbg.cu = !{!0}
112 !llvm.module.flags = !{!3, !4}
113 !llvm.ident = !{!5}
114
115 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 4.0.0 (trunk 288231)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
116 !1 = !DIFile(filename: "linkage-name-abstract-static.cpp", directory: "/home/probinson/projects/scratch")
117 !2 = !{}
118 !3 = !{i32 2, !"Dwarf Version", i32 4}
119 !4 = !{i32 2, !"Debug Info Version", i32 3}
120 !5 = !{!"clang version 4.0.0 (trunk 288231)"}
121 !6 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !1, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
122 !7 = !DISubroutineType(types: !8)
123 !8 = !{null}
124 !9 = !DILocation(line: 3, column: 3, scope: !6)
125 !10 = !DILocation(line: 4, column: 1, scope: !6)
126 !11 = distinct !DISubprogram(name: "f3", linkageName: "_Z2f3v", scope: !1, file: !1, line: 5, type: !7, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
127 !12 = !DILocation(line: 3, column: 3, scope: !6, inlinedAt: !13)
128 !13 = distinct !DILocation(line: 6, column: 3, scope: !11)
129 !14 = !DILocation(line: 7, column: 1, scope: !11)
130 !15 = distinct !DISubprogram(name: "f5", linkageName: "_ZN2F42f5Ev", scope: !16, file: !1, line: 12, type: !7, isLocal: false, isDefinition: true, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !18, retainedNodes: !2)
131 !16 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "F4", file: !1, line: 9, size: 8, elements: !17, identifier: "_ZTS2F4")
132 !17 = !{!18}
133 !18 = !DISubprogram(name: "f5", linkageName: "_ZN2F42f5Ev", scope: !16, file: !1, line: 10, type: !7, isLocal: false, isDefinition: false, scopeLine: 10, flags: DIFlagPrototyped, isOptimized: false)
134 !19 = !DILocation(line: 13, column: 3, scope: !15)
135 !20 = !DILocation(line: 14, column: 1, scope: !15)
136 !21 = distinct !DISubprogram(name: "f6", linkageName: "_Z2f6v", scope: !1, file: !1, line: 15, type: !7, isLocal: false, isDefinition: true, scopeLine: 15, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
137 !22 = !DILocation(line: 13, column: 3, scope: !15, inlinedAt: !23)
138 !23 = distinct !DILocation(line: 16, column: 3, scope: !21)
139 !24 = !DILocation(line: 17, column: 1, scope: !21)