1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
| ; RUN: llc -frame-pointer=all -O0 -fast-isel -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck %s
; Test that a variable with multiple entries in the MMI table makes it into the
; debug info.
;
; CHECK: DW_TAG_inlined_subroutine
; CHECK: "_Z3f111A"
; CHECK: DW_TAG_formal_parameter
; CHECK: DW_AT_location [DW_FORM_block1] (DW_OP_piece 0x1, DW_OP_fbreg -47, DW_OP_piece 0xf, DW_OP_piece 0x1, DW_OP_fbreg -54, DW_OP_piece 0x7)
; CHECK: DW_AT_abstract_origin {{.*}} "p1"
;
; long a;
; struct A {
; bool x4;
; void *x5;
; bool x6;
; };
; int *b;
; struct B {
; B(long);
; ~B();
; };
; void f9(A);
; void f13(A p1) {
; b = (int *)__builtin_operator_new(a);
; f9(p1);
; }
; void f11(A p1) { f13(p1); }
; void f16() {
; A c;
; B d(a);
; c.x6 = c.x4 = true;
; f11(c);
; }
; ModuleID = 'test.cpp'
source_filename = "test/DebugInfo/AArch64/frameindices.ll"
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-apple-ios"
%struct.A = type { i8, i8*, i8 }
%struct.B = type { i8 }
@a = global i64 0, align 8, !dbg !0
@b = global i32* null, align 8, !dbg !4
define void @_Z3f131A(%struct.A* nocapture readonly %p1) !dbg !32 {
entry:
%agg.tmp = alloca %struct.A, align 8
tail call void @llvm.dbg.declare(metadata %struct.A* %p1, metadata !36, metadata !37), !dbg !38
%0 = load i64, i64* @a, align 8, !dbg !39, !tbaa !40
%call = tail call noalias i8* @_Znwm(i64 %0) #4, !dbg !44
store i8* %call, i8** bitcast (i32** @b to i8**), align 8, !dbg !45, !tbaa !46
%1 = getelementptr inbounds %struct.A, %struct.A* %agg.tmp, i64 0, i32 0, !dbg !48
%2 = getelementptr inbounds %struct.A, %struct.A* %p1, i64 0, i32 0, !dbg !48
call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %1, i8* align 8 %2, i64 24, i1 false), !dbg !48, !tbaa.struct !49
call void @_Z2f91A(%struct.A* %agg.tmp), !dbg !52
ret void, !dbg !53
}
; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
; Function Attrs: nobuiltin
declare noalias i8* @_Znwm(i64) #1
declare void @_Z2f91A(%struct.A*)
; Function Attrs: argmemonly nounwind
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) #2
define void @_Z3f111A(%struct.A* nocapture readonly %p1) !dbg !54 {
entry:
%agg.tmp.i = alloca %struct.A, align 8
tail call void @llvm.dbg.declare(metadata %struct.A* %p1, metadata !56, metadata !37), !dbg !57
%0 = getelementptr inbounds %struct.A, %struct.A* %p1, i64 0, i32 0, !dbg !58
%1 = getelementptr inbounds %struct.A, %struct.A* %agg.tmp.i, i64 0, i32 0, !dbg !59
call void @llvm.lifetime.start(i64 24, i8* %1), !dbg !59
%2 = load i64, i64* @a, align 8, !dbg !61, !tbaa !40
%call.i = tail call noalias i8* @_Znwm(i64 %2) #4, !dbg !62
store i8* %call.i, i8** bitcast (i32** @b to i8**), align 8, !dbg !63, !tbaa !46
call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %1, i8* align 8 %0, i64 24, i1 false), !dbg !64
call void @_Z2f91A(%struct.A* %agg.tmp.i), !dbg !65
call void @llvm.lifetime.end(i64 24, i8* %1), !dbg !66
ret void, !dbg !67
}
define void @_Z3f16v() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) !dbg !68 {
entry:
%agg.tmp.i.i = alloca %struct.A, align 8
%d = alloca %struct.B, align 1
%agg.tmp.sroa.2 = alloca [15 x i8], align 1
%agg.tmp.sroa.4 = alloca [7 x i8], align 1
tail call void @llvm.dbg.declare(metadata [15 x i8]* %agg.tmp.sroa.2, metadata !56, metadata !74), !dbg !75
tail call void @llvm.dbg.declare(metadata [7 x i8]* %agg.tmp.sroa.4, metadata !56, metadata !77), !dbg !75
tail call void @llvm.dbg.declare(metadata %struct.A* undef, metadata !72, metadata !37), !dbg !78
%0 = load i64, i64* @a, align 8, !dbg !79, !tbaa !40
tail call void @llvm.dbg.value(metadata %struct.B* %d, metadata !73, metadata !37), !dbg !80
%call = call %struct.B* @_ZN1BC1El(%struct.B* %d, i64 %0), !dbg !80
call void @llvm.dbg.value(metadata i8 1, metadata !72, metadata !81), !dbg !78
call void @llvm.dbg.value(metadata i8 1, metadata !72, metadata !82), !dbg !78
call void @llvm.dbg.value(metadata i8 1, metadata !56, metadata !81), !dbg !75
call void @llvm.dbg.value(metadata i8 1, metadata !56, metadata !82), !dbg !75
call void @llvm.dbg.declare(metadata %struct.A* undef, metadata !56, metadata !37), !dbg !75
%1 = getelementptr inbounds %struct.A, %struct.A* %agg.tmp.i.i, i64 0, i32 0, !dbg !83
call void @llvm.lifetime.start(i64 24, i8* %1), !dbg !83
%2 = load i64, i64* @a, align 8, !dbg !85, !tbaa !40
%call.i.i5 = invoke noalias i8* @_Znwm(i64 %2) #4
to label %call.i.i.noexc unwind label %lpad, !dbg !86
call.i.i.noexc: ; preds = %entry
%agg.tmp.sroa.4.17..sroa_idx = getelementptr inbounds [7 x i8], [7 x i8]* %agg.tmp.sroa.4, i64 0, i64 0, !dbg !87
%agg.tmp.sroa.2.1..sroa_idx = getelementptr inbounds [15 x i8], [15 x i8]* %agg.tmp.sroa.2, i64 0, i64 0, !dbg !87
store i8* %call.i.i5, i8** bitcast (i32** @b to i8**), align 8, !dbg !88, !tbaa !46
store i8 1, i8* %1, align 8, !dbg !89
%agg.tmp.sroa.2.0..sroa_raw_idx = getelementptr inbounds i8, i8* %1, i64 1, !dbg !89
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %agg.tmp.sroa.2.0..sroa_raw_idx, i8* %agg.tmp.sroa.2.1..sroa_idx, i64 15, i1 false), !dbg !89
%agg.tmp.sroa.3.0..sroa_idx = getelementptr inbounds %struct.A, %struct.A* %agg.tmp.i.i, i64 0, i32 2, !dbg !89
store i8 1, i8* %agg.tmp.sroa.3.0..sroa_idx, align 8, !dbg !89
%agg.tmp.sroa.4.0..sroa_raw_idx = getelementptr inbounds i8, i8* %1, i64 17, !dbg !89
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %agg.tmp.sroa.4.0..sroa_raw_idx, i8* %agg.tmp.sroa.4.17..sroa_idx, i64 7, i1 false), !dbg !89
invoke void @_Z2f91A(%struct.A* %agg.tmp.i.i)
to label %invoke.cont unwind label %lpad, !dbg !90
invoke.cont: ; preds = %call.i.i.noexc
call void @llvm.lifetime.end(i64 24, i8* %1), !dbg !91
call void @llvm.dbg.value(metadata %struct.B* %d, metadata !73, metadata !37), !dbg !80
%call1 = call %struct.B* @_ZN1BD1Ev(%struct.B* %d) #3, !dbg !92
ret void, !dbg !92
lpad: ; preds = %call.i.i.noexc, %entry
%3 = landingpad { i8*, i32 }
cleanup, !dbg !92
call void @llvm.dbg.value(metadata %struct.B* %d, metadata !73, metadata !37), !dbg !80
%call2 = call %struct.B* @_ZN1BD1Ev(%struct.B* %d) #3, !dbg !92
resume { i8*, i32 } %3, !dbg !92
}
declare %struct.B* @_ZN1BC1El(%struct.B*, i64)
declare i32 @__gxx_personality_v0(...)
; Function Attrs: nounwind
declare %struct.B* @_ZN1BD1Ev(%struct.B*) #3
; Function Attrs: nounwind readnone
declare void @llvm.dbg.value(metadata, metadata, metadata) #0
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start(i64, i8* nocapture) #2
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end(i64, i8* nocapture) #2
attributes #0 = { nounwind readnone }
attributes #1 = { nobuiltin }
attributes #2 = { argmemonly nounwind }
attributes #3 = { nounwind }
attributes #4 = { builtin }
!llvm.dbg.cu = !{!8}
!llvm.module.flags = !{!29, !30}
!llvm.ident = !{!31}
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = !DIGlobalVariable(name: "a", scope: null, file: !2, line: 1, type: !3, isLocal: false, isDefinition: true)
!2 = !DIFile(filename: "test.cpp", directory: "")
!3 = !DIBasicType(name: "long int", size: 64, align: 64, encoding: DW_ATE_signed)
!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
!5 = !DIGlobalVariable(name: "b", scope: null, file: !2, line: 7, type: !6, isLocal: false, isDefinition: true)
!6 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64, align: 64)
!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!8 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !9, producer: "clang version 3.7.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !10, retainedTypes: !11, globals: !28, imports: !10)
!9 = !DIFile(filename: "<stdin>", directory: "")
!10 = !{}
!11 = !{!12, !6, !19}
!12 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !2, line: 2, size: 192, align: 64, elements: !13, identifier: "_ZTS1A")
!13 = !{!14, !16, !18}
!14 = !DIDerivedType(tag: DW_TAG_member, name: "x4", scope: !12, file: !2, line: 3, baseType: !15, size: 8, align: 8)
!15 = !DIBasicType(name: "bool", size: 8, align: 8, encoding: DW_ATE_boolean)
!16 = !DIDerivedType(tag: DW_TAG_member, name: "x5", scope: !12, file: !2, line: 4, baseType: !17, size: 64, align: 64, offset: 64)
!17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64, align: 64)
!18 = !DIDerivedType(tag: DW_TAG_member, name: "x6", scope: !12, file: !2, line: 5, baseType: !15, size: 8, align: 8, offset: 128)
!19 = !DICompositeType(tag: DW_TAG_structure_type, name: "B", file: !2, line: 8, size: 8, align: 8, elements: !20, identifier: "_ZTS1B")
!20 = !{!21, !25}
!21 = !DISubprogram(name: "B", scope: !19, file: !2, line: 9, type: !22, isLocal: false, isDefinition: false, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true)
!22 = !DISubroutineType(types: !23)
!23 = !{null, !24, !3}
!24 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !19, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
!25 = !DISubprogram(name: "~B", scope: !19, file: !2, line: 10, type: !26, isLocal: false, isDefinition: false, scopeLine: 10, flags: DIFlagPrototyped, isOptimized: true)
!26 = !DISubroutineType(types: !27)
!27 = !{null, !24}
!28 = !{!0, !4}
!29 = !{i32 2, !"Dwarf Version", i32 2}
!30 = !{i32 2, !"Debug Info Version", i32 3}
!31 = !{!"clang version 3.7.0 "}
!32 = distinct !DISubprogram(name: "f13", linkageName: "_Z3f131A", scope: !2, file: !2, line: 13, type: !33, isLocal: false, isDefinition: true, scopeLine: 13, flags: DIFlagPrototyped, isOptimized: true, unit: !8, retainedNodes: !35)
!33 = !DISubroutineType(types: !34)
!34 = !{null, !12}
!35 = !{!36}
!36 = !DILocalVariable(name: "p1", arg: 1, scope: !32, file: !2, line: 13, type: !12)
!37 = !DIExpression(DW_OP_deref)
!38 = !DILocation(line: 13, column: 12, scope: !32)
!39 = !DILocation(line: 14, column: 37, scope: !32)
!40 = !{!41, !41, i64 0}
!41 = !{!"long", !42, i64 0}
!42 = !{!"omnipotent char", !43, i64 0}
!43 = !{!"Simple C/C++ TBAA"}
!44 = !DILocation(line: 14, column: 14, scope: !32)
!45 = !DILocation(line: 14, column: 5, scope: !32)
!46 = !{!47, !47, i64 0}
!47 = !{!"any pointer", !42, i64 0}
!48 = !DILocation(line: 15, column: 6, scope: !32)
!49 = !{i64 0, i64 1, !50, i64 8, i64 8, !46, i64 16, i64 1, !50}
!50 = !{!51, !51, i64 0}
!51 = !{!"bool", !42, i64 0}
!52 = !DILocation(line: 15, column: 3, scope: !32)
!53 = !DILocation(line: 16, column: 1, scope: !32)
!54 = distinct !DISubprogram(name: "f11", linkageName: "_Z3f111A", scope: !2, file: !2, line: 17, type: !33, isLocal: false, isDefinition: true, scopeLine: 17, flags: DIFlagPrototyped, isOptimized: true, unit: !8, retainedNodes: !55)
!55 = !{!56}
!56 = !DILocalVariable(name: "p1", arg: 1, scope: !54, file: !2, line: 17, type: !12)
!57 = !DILocation(line: 17, column: 12, scope: !54)
!58 = !DILocation(line: 17, column: 22, scope: !54)
!59 = !DILocation(line: 13, column: 12, scope: !32, inlinedAt: !60)
!60 = distinct !DILocation(line: 17, column: 18, scope: !54)
!61 = !DILocation(line: 14, column: 37, scope: !32, inlinedAt: !60)
!62 = !DILocation(line: 14, column: 14, scope: !32, inlinedAt: !60)
!63 = !DILocation(line: 14, column: 5, scope: !32, inlinedAt: !60)
!64 = !DILocation(line: 15, column: 6, scope: !32, inlinedAt: !60)
!65 = !DILocation(line: 15, column: 3, scope: !32, inlinedAt: !60)
!66 = !DILocation(line: 16, column: 1, scope: !32, inlinedAt: !60)
!67 = !DILocation(line: 17, column: 27, scope: !54)
!68 = distinct !DISubprogram(name: "f16", linkageName: "_Z3f16v", scope: !2, file: !2, line: 18, type: !69, isLocal: false, isDefinition: true, scopeLine: 18, flags: DIFlagPrototyped, isOptimized: true, unit: !8, retainedNodes: !71)
!69 = !DISubroutineType(types: !70)
!70 = !{null}
!71 = !{!72, !73}
!72 = !DILocalVariable(name: "c", scope: !68, file: !2, line: 19, type: !12)
!73 = !DILocalVariable(name: "d", scope: !68, file: !2, line: 20, type: !19)
!74 = !DIExpression(DW_OP_LLVM_fragment, 8, 120)
!75 = !DILocation(line: 17, column: 12, scope: !54, inlinedAt: !76)
!76 = distinct !DILocation(line: 22, column: 3, scope: !68)
!77 = !DIExpression(DW_OP_LLVM_fragment, 136, 56)
!78 = !DILocation(line: 19, column: 5, scope: !68)
!79 = !DILocation(line: 20, column: 7, scope: !68)
!80 = !DILocation(line: 20, column: 5, scope: !68)
!81 = !DIExpression(DW_OP_LLVM_fragment, 0, 8)
!82 = !DIExpression(DW_OP_LLVM_fragment, 128, 8)
!83 = !DILocation(line: 13, column: 12, scope: !32, inlinedAt: !84)
!84 = distinct !DILocation(line: 17, column: 18, scope: !54, inlinedAt: !76)
!85 = !DILocation(line: 14, column: 37, scope: !32, inlinedAt: !84)
!86 = !DILocation(line: 14, column: 14, scope: !32, inlinedAt: !84)
!87 = !DILocation(line: 22, column: 7, scope: !68)
!88 = !DILocation(line: 14, column: 5, scope: !32, inlinedAt: !84)
!89 = !DILocation(line: 15, column: 6, scope: !32, inlinedAt: !84)
!90 = !DILocation(line: 15, column: 3, scope: !32, inlinedAt: !84)
!91 = !DILocation(line: 16, column: 1, scope: !32, inlinedAt: !84)
!92 = !DILocation(line: 23, column: 1, scope: !68)
|