Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/Generic/PR20038.ll

raw
1 ; REQUIRES: object-emission
2
3 ; For some reason, the output when targetting sparc is not quite as expected.
4 ; XFAIL: sparc
5
6 ; RUN: llvm-as < %s -o %t.bc
7 ; RUN: llvm-spirv %t.bc -o %t.spv
8 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll
9
10 ; RUN: llc -mtriple=%triple -O0 -filetype=obj -dwarf-linkage-names=All < %t.ll | llvm-dwarfdump -v -debug-info - | FileCheck %s
11
12 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"
13 target triple = "spir64-unknown-unknown"
14
15 ; IR generated from clang -O0 with:
16 ; struct C {
17 ; ~C();
18 ; };
19 ; extern bool b;
20 ; void fun4() { b && (C(), 1); }
21 ; __attribute__((always_inline)) C::~C() { }
22
23 ; CHECK: DW_TAG_structure_type
24 ; CHECK-NOT: DW_TAG
25 ; CHECK: DW_AT_name {{.*}} "C"
26 ; CHECK-NOT: {{DW_TAG|NULL}}
27 ; CHECK: DW_TAG_subprogram
28 ; CHECK-NOT: DW_TAG
29 ; CHECK: DW_AT_name {{.*}} "~C"
30
31 ; CHECK: DW_TAG_subprogram
32 ; CHECK-NOT: DW_TAG
33 ; CHECK: DW_AT_linkage_name {{.*}} "_ZN1CD1Ev"
34 ; CHECK-NOT: {{DW_TAG|NULL}}
35 ; CHECK: DW_TAG_formal_parameter
36 ; CHECK-NOT: DW_TAG
37 ; CHECK: DW_AT_name {{.*}} "this"
38
39 ; CHECK: DW_TAG_subprogram
40 ; CHECK-NOT: DW_TAG
41 ; CHECK: DW_AT_name {{.*}} "fun4"
42 ; CHECK-NOT: {{DW_TAG|NULL}}
43 ; CHECK: DW_TAG_inlined_subroutine
44 ; CHECK-NOT: DW_TAG
45 ; CHECK: DW_AT_abstract_origin {{.*}} "_ZN1CD1Ev"
46 ; CHECK-NOT: {{DW_TAG|NULL}}
47 ; CHECK: DW_TAG_formal_parameter
48 ; CHECK-NOT: DW_TAG
49 ; CHECK: DW_AT_abstract_origin {{.*}} "this"
50
51 ; FIXME: D2 is actually inlined into D1 but doesn't show up here, possibly due
52 ; to there being no work in D2 (calling another member function from the dtor
53 ; causes D2 to show up, calling a free function doesn't).
54
55 ; CHECK-NOT: DW_TAG
56 ; CHECK: NULL
57 ; CHECK-NOT: DW_TAG
58 ; CHECK: NULL
59
60 %struct.C = type { i8 }
61
62 @b = external global i8
63
64 ; Function Attrs: nounwind
65 define void @_Z4fun4v() #0 !dbg !12 {
66 entry:
67 %this.addr.i.i = alloca %struct.C*, align 8, !dbg !21
68 %this.addr.i = alloca %struct.C*, align 8, !dbg !22
69 %agg.tmp.ensured = alloca %struct.C, align 1
70 %cleanup.cond = alloca i1
71 %0 = load i8, i8* @b, align 1, !dbg !24
72 %tobool = trunc i8 %0 to i1, !dbg !24
73 store i1 false, i1* %cleanup.cond
74 br i1 %tobool, label %land.rhs, label %land.end, !dbg !24
75
76 land.rhs: ; preds = %entry
77 store i1 true, i1* %cleanup.cond, !dbg !25
78 br label %land.end
79
80 land.end: ; preds = %land.rhs, %entry
81 %1 = phi i1 [ false, %entry ], [ true, %land.rhs ]
82 %cleanup.is_active = load i1, i1* %cleanup.cond, !dbg !27
83 br i1 %cleanup.is_active, label %cleanup.action, label %cleanup.done, !dbg !27
84
85 cleanup.action: ; preds = %land.end
86 store %struct.C* %agg.tmp.ensured, %struct.C** %this.addr.i, align 8, !dbg !22
87 call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !129, metadata !DIExpression()), !dbg !31
88 %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !22
89 store %struct.C* %this1.i, %struct.C** %this.addr.i.i, align 8, !dbg !21
90 call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i.i, metadata !132, metadata !DIExpression()), !dbg !33
91 %this1.i.i = load %struct.C*, %struct.C** %this.addr.i.i, !dbg !21
92 br label %cleanup.done, !dbg !22
93
94 cleanup.done: ; preds = %cleanup.action, %land.end
95 ret void, !dbg !34
96 }
97
98 ; Function Attrs: alwaysinline nounwind
99 define void @_ZN1CD1Ev(%struct.C* %this) unnamed_addr #1 align 2 !dbg !17 {
100 entry:
101 %this.addr.i = alloca %struct.C*, align 8, !dbg !37
102 %this.addr = alloca %struct.C*, align 8
103 store %struct.C* %this, %struct.C** %this.addr, align 8
104 call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !29, metadata !DIExpression()), !dbg !38
105 %this1 = load %struct.C*, %struct.C** %this.addr
106 store %struct.C* %this1, %struct.C** %this.addr.i, align 8, !dbg !37
107 call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !232, metadata !DIExpression()), !dbg !39
108 %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !37
109 ret void, !dbg !37
110 }
111
112 ; Function Attrs: alwaysinline nounwind
113 define void @_ZN1CD2Ev(%struct.C* %this) unnamed_addr #1 align 2 !dbg !16 {
114 entry:
115 %this.addr = alloca %struct.C*, align 8
116 store %struct.C* %this, %struct.C** %this.addr, align 8
117 call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !32, metadata !DIExpression()), !dbg !40
118 %this1 = load %struct.C*, %struct.C** %this.addr
119 ret void, !dbg !41
120 }
121
122 ; Function Attrs: nounwind readnone
123 declare void @llvm.dbg.declare(metadata, metadata, metadata) #2
124
125 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
126 attributes #1 = { alwaysinline nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
127 attributes #2 = { nounwind readnone }
128
129 !llvm.dbg.cu = !{!0}
130 !llvm.module.flags = !{!18, !19}
131 !llvm.ident = !{!20}
132
133 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2)
134 !1 = !DIFile(filename: "<stdin>", directory: "/tmp/dbginfo")
135 !2 = !{}
136 !3 = !{!4}
137 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !5, elements: !6, identifier: "_ZTS1C")
138 !5 = !DIFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo")
139 !6 = !{!7}
140 !7 = !DISubprogram(name: "~C", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !4, type: !8)
141 !8 = !DISubroutineType(types: !9)
142 !9 = !{null, !10}
143 !10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
144 !12 = distinct !DISubprogram(name: "fun4", linkageName: "_Z4fun4v", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 5, file: !5, scope: !13, type: !14, retainedNodes: !2)
145 !13 = !DIFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo")
146 !14 = !DISubroutineType(types: !15)
147 !15 = !{null}
148 !16 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD2Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !5, scope: !4, type: !8, declaration: !7, retainedNodes: !2)
149 !17 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD1Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !5, scope: !4, type: !8, declaration: !7, retainedNodes: !2)
150 !18 = !{i32 2, !"Dwarf Version", i32 4}
151 !19 = !{i32 2, !"Debug Info Version", i32 3}
152 !20 = !{!"clang version 3.5.0 "}
153 !21 = !DILocation(line: 6, scope: !17, inlinedAt: !22)
154 !22 = !DILocation(line: 5, scope: !23)
155 !23 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
156 !24 = !DILocation(line: 5, scope: !12)
157 !25 = !DILocation(line: 5, scope: !26)
158 !26 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
159 !27 = !DILocation(line: 5, scope: !28)
160 !28 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
161 !29 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30)
162 !30 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4)
163 !31 = !DILocation(line: 0, scope: !17, inlinedAt: !22)
164 !32 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
165 !33 = !DILocation(line: 0, scope: !16, inlinedAt: !21)
166
167 !129 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30)
168 !132 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
169 !232 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
170
171 !34 = !DILocation(line: 5, scope: !35)
172 !35 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !36)
173 !36 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
174 !37 = !DILocation(line: 6, scope: !17)
175 !38 = !DILocation(line: 0, scope: !17)
176 !39 = !DILocation(line: 0, scope: !16, inlinedAt: !37)
177 !40 = !DILocation(line: 0, scope: !16)
178 !41 = !DILocation(line: 6, scope: !16)