1 # RUN: llc -run-pass livedebugvalues -march=x86-64 -o - %s | FileCheck %s
3 # Generated from the following source with:
4 # clang -g -mllvm -stop-before=livedebugvalues -S -O2 test.c -o test.mir
5 # Then more functions added to test for extra behaviours with complex
7 # 'g': test for a crash from PR42773
8 # 'h': complex expressions should be restored
9 # 'i': spills should be restored across block boundaries
10 # 'j': indirect DBG_VALUEs should be indirect after restoration
12 # #define FORCE_SPILL() \
13 # __asm volatile("" : : : \
14 # "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "rbp", "r8", \
15 # "r9", "r10", "r11", "r12", "r13", "r14", "r15")
23 # Pick out DILocalVariable numbers for "p", "q" and "r" etc
24 # CHECK: ![[PVAR:[0-9]+]] = !DILocalVariable(name: "p",
25 # CHECK: ![[QVAR:[0-9]+]] = !DILocalVariable(name: "q",
26 # CHECK: ![[RVAR:[0-9]+]] = !DILocalVariable(name: "r",
27 # CHECK: ![[SVAR:[0-9]+]] = !DILocalVariable(name: "s",
28 # CHECK: ![[TVAR:[0-9]+]] = !DILocalVariable(name: "t",
30 # Ascertain that the spill has been recognized and manifested in a DBG_VALUE.
31 # CHECK: MOV64mr $rsp,{{.*-8.*}}killed{{.*}}$rdi :: (store 8 into %stack.0)
32 # CHECK-NEXT: DBG_VALUE $rsp,{{.*}}![[PVAR]],{{.*}}!DIExpression(DW_OP_constu, 8, DW_OP_minus)
34 # Check for the restore.
35 # CHECK: $rdi = MOV64rm $rsp,{{.*-8.*}}:: (load 8 from %stack.0)
36 # CHECK-NEXT: DBG_VALUE $rdi,{{.*}}![[PVAR]], !DIExpression()
39 define dso_local i32 @f(i32* readonly %p) local_unnamed_addr !dbg !7 {
41 call void @llvm.dbg.value(metadata i32* %p, metadata !13, metadata !DIExpression()), !dbg !14
42 %tobool = icmp eq i32* %p, null, !dbg !15
43 br i1 %tobool, label %if.end, label %if.then, !dbg !17
45 if.then: ; preds = %entry
46 tail call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"(), !dbg !18, !srcloc !20
47 br label %if.end, !dbg !21
49 if.end: ; preds = %entry, %if.then
50 %add.ptr = getelementptr inbounds i32, i32* %p, i64 1, !dbg !22
51 %0 = load i32, i32* %add.ptr, align 4, !dbg !23, !tbaa !24
55 define dso_local i32 @g(i32* readonly %p) local_unnamed_addr !dbg !107 {
57 call void @llvm.dbg.value(metadata i32* %p, metadata !113, metadata !DIExpression()), !dbg !114
58 %tobool = icmp eq i32* %p, null, !dbg !115
59 br i1 %tobool, label %if.end, label %if.then, !dbg !117
61 if.then: ; preds = %entry
62 tail call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"(), !dbg !118, !srcloc !120
63 br label %if.end, !dbg !121
65 if.end: ; preds = %entry, %if.then
66 %add.ptr = getelementptr inbounds i32, i32* %p, i64 1, !dbg !122
67 %0 = load i32, i32* %add.ptr, align 4, !dbg !123, !tbaa !24
71 define dso_local i32 @h(i32* readonly %p) local_unnamed_addr !dbg !207 {
73 call void @llvm.dbg.value(metadata i32* %p, metadata !213, metadata !DIExpression()), !dbg !214
74 %tobool = icmp eq i32* %p, null, !dbg !215
75 br i1 %tobool, label %if.end, label %if.then, !dbg !217
77 if.then: ; preds = %entry
78 tail call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"(), !dbg !218, !srcloc !220
79 br label %if.end, !dbg !221
81 if.end: ; preds = %entry, %if.then
82 %add.ptr = getelementptr inbounds i32, i32* %p, i64 1, !dbg !222
83 %0 = load i32, i32* %add.ptr, align 4, !dbg !223, !tbaa !24
87 define dso_local i32 @i(i32* readonly %p) local_unnamed_addr !dbg !307 {
92 call void @llvm.dbg.value(metadata i32* %p, metadata !313, metadata !DIExpression()), !dbg !314
93 %tobool = icmp eq i32* %p, null, !dbg !315
94 br i1 %tobool, label %if.end, label %if.then, !dbg !317
96 if.then: ; preds = %entry
97 tail call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"(), !dbg !318, !srcloc !320
98 br label %if.end, !dbg !321
100 if.end: ; preds = %entry, %if.then
101 %add.ptr = getelementptr inbounds i32, i32* %p, i64 1, !dbg !322
102 %0 = load i32, i32* %add.ptr, align 4, !dbg !323, !tbaa !24
103 ret i32 %0, !dbg !328
106 define dso_local i32 @j(i32* readonly %p) local_unnamed_addr !dbg !402 {
111 call void @llvm.dbg.value(metadata i32* %p, metadata !404, metadata !DIExpression()), !dbg !405
112 %tobool = icmp eq i32* %p, null, !dbg !406
113 br i1 %tobool, label %if.end, label %if.then, !dbg !408
115 if.then: ; preds = %entry
116 tail call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"(), !dbg !409, !srcloc !411
117 br label %if.end, !dbg !412
119 if.end: ; preds = %entry, %if.then
120 %add.ptr = getelementptr inbounds i32, i32* %p, i64 1, !dbg !413
121 %0 = load i32, i32* %add.ptr, align 4, !dbg !414, !tbaa !24
122 ret i32 %0, !dbg !415
125 declare void @llvm.dbg.value(metadata, metadata, metadata)
128 !llvm.module.flags = !{!3, !4, !5}
131 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 9.0.0 (https://git.llvm.org/git/clang.git/ 57a6ce7ac318de98e3e777e09cb9ed8282b5cc03) (https://git.llvm.org/git/llvm.git/ ff54a19e4912d7f15cb02798a7f2048441bff751)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
132 !1 = !DIFile(filename: "test2.c", directory: "/home/test")
134 !3 = !{i32 2, !"Dwarf Version", i32 4}
135 !4 = !{i32 2, !"Debug Info Version", i32 3}
136 !5 = !{i32 1, !"wchar_size", i32 4}
137 !6 = !{!"clang version 9.0.0 (https://git.llvm.org/git/clang.git/ 57a6ce7ac318de98e3e777e09cb9ed8282b5cc03) (https://git.llvm.org/git/llvm.git/ ff54a19e4912d7f15cb02798a7f2048441bff751)"}
138 !7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12)
139 !8 = !DISubroutineType(types: !9)
141 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
142 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64)
144 !13 = !DILocalVariable(name: "p", arg: 1, scope: !7, file: !1, line: 5, type: !11)
145 !14 = !DILocation(line: 5, column: 12, scope: !7)
146 !15 = !DILocation(line: 6, column: 7, scope: !16)
147 !16 = distinct !DILexicalBlock(scope: !7, file: !1, line: 6, column: 7)
148 !17 = !DILocation(line: 6, column: 7, scope: !7)
149 !18 = !DILocation(line: 7, column: 5, scope: !19)
150 !19 = distinct !DILexicalBlock(scope: !16, file: !1, line: 6, column: 10)
151 !20 = !{i32 -2147471544}
152 !21 = !DILocation(line: 8, column: 3, scope: !19)
153 !22 = !DILocation(line: 9, column: 14, scope: !7)
154 !23 = !DILocation(line: 9, column: 10, scope: !7)
155 !24 = !{!25, !25, i64 0}
156 !25 = !{!"int", !26, i64 0}
157 !26 = !{!"omnipotent char", !27, i64 0}
158 !27 = !{!"Simple C/C++ TBAA"}
159 !28 = !DILocation(line: 9, column: 3, scope: !7)
160 !101 = !DIBasicType(name: "looong int", size: 64, encoding: DW_ATE_signed)
161 !107 = distinct !DISubprogram(name: "g", scope: !0, file: !1, line: 105, type: !8, scopeLine: 105, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !112)
163 !113 = !DILocalVariable(name: "q", arg: 1, scope: !107, file: !1, line: 105, type: !101)
164 !114 = !DILocation(line: 105, column: 12, scope: !107)
165 !115 = !DILocation(line: 106, column: 7, scope: !116)
166 !116 = distinct !DILexicalBlock(scope: !107, file: !1, line: 106, column: 7)
167 !117 = !DILocation(line: 106, column: 7, scope: !107)
168 !118 = !DILocation(line: 107, column: 5, scope: !119)
169 !119 = distinct !DILexicalBlock(scope: !116, file: !1, line: 106, column: 10)
170 !120 = !{i32 -2147471544}
171 !121 = !DILocation(line: 108, column: 3, scope: !119)
172 !122 = !DILocation(line: 109, column: 14, scope: !107)
173 !123 = !DILocation(line: 109, column: 10, scope: !107)
174 !128 = !DILocation(line: 109, column: 3, scope: !107)
175 !201 = !DIBasicType(name: "looong int", size: 64, encoding: DW_ATE_signed)
176 !207 = distinct !DISubprogram(name: "g", scope: !0, file: !1, line: 105, type: !8, scopeLine: 105, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !212)
178 !213 = !DILocalVariable(name: "r", arg: 1, scope: !207, file: !1, line: 105, type: !201)
179 !214 = !DILocation(line: 105, column: 12, scope: !207)
180 !215 = !DILocation(line: 106, column: 7, scope: !216)
181 !216 = distinct !DILexicalBlock(scope: !207, file: !1, line: 106, column: 7)
182 !217 = !DILocation(line: 106, column: 7, scope: !207)
183 !218 = !DILocation(line: 107, column: 5, scope: !219)
184 !219 = distinct !DILexicalBlock(scope: !216, file: !1, line: 106, column: 10)
185 !220 = !{i32 -2147471544}
186 !221 = !DILocation(line: 108, column: 3, scope: !219)
187 !222 = !DILocation(line: 109, column: 14, scope: !207)
188 !223 = !DILocation(line: 109, column: 10, scope: !207)
189 !228 = !DILocation(line: 109, column: 3, scope: !207)
190 !301 = !DIBasicType(name: "looong int", size: 64, encoding: DW_ATE_signed)
191 !307 = distinct !DISubprogram(name: "g", scope: !0, file: !1, line: 105, type: !8, scopeLine: 105, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !312)
193 !313 = !DILocalVariable(name: "s", arg: 1, scope: !307, file: !1, line: 105, type: !301)
194 !314 = !DILocation(line: 105, column: 12, scope: !307)
195 !315 = !DILocation(line: 106, column: 7, scope: !316)
196 !316 = distinct !DILexicalBlock(scope: !307, file: !1, line: 106, column: 7)
197 !317 = !DILocation(line: 106, column: 7, scope: !307)
198 !318 = !DILocation(line: 107, column: 5, scope: !319)
199 !319 = distinct !DILexicalBlock(scope: !316, file: !1, line: 106, column: 10)
200 !320 = !{i32 -2147471544}
201 !321 = !DILocation(line: 108, column: 3, scope: !319)
202 !322 = !DILocation(line: 109, column: 14, scope: !307)
203 !323 = !DILocation(line: 109, column: 10, scope: !307)
204 !328 = !DILocation(line: 109, column: 3, scope: !307)
205 !401 = !DIBasicType(name: "looong int", size: 64, encoding: DW_ATE_signed)
206 !402 = distinct !DISubprogram(name: "j", scope: !0, file: !1, line: 105, type: !8, scopeLine: 105, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !403)
208 !404 = !DILocalVariable(name: "t", arg: 1, scope: !402, file: !1, line: 105, type: !401)
209 !405 = !DILocation(line: 105, column: 12, scope: !402)
210 !406 = !DILocation(line: 106, column: 7, scope: !407)
211 !407 = distinct !DILexicalBlock(scope: !402, file: !1, line: 106, column: 7)
212 !408 = !DILocation(line: 106, column: 7, scope: !402)
213 !409 = !DILocation(line: 107, column: 5, scope: !410)
214 !410 = distinct !DILexicalBlock(scope: !407, file: !1, line: 106, column: 10)
215 !411 = !{i32 -2147471544}
216 !412 = !DILocation(line: 108, column: 3, scope: !410)
217 !413 = !DILocation(line: 109, column: 14, scope: !402)
218 !414 = !DILocation(line: 109, column: 10, scope: !402)
219 !415 = !DILocation(line: 109, column: 3, scope: !402)
224 exposesReturnsTwice: false
226 regBankSelected: false
229 tracksRegLiveness: true
233 - { reg: '$rdi', virtual-reg: '' }
235 isFrameAddressTaken: false
236 isReturnAddressTaken: false
240 offsetAdjustment: -48
246 cvBytesOfCalleeSavedRegisters: 48
247 hasOpaqueSPAdjustment: false
249 hasMustTailInVarArgFunc: false
254 - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, stack-id: default,
255 callee-saved-register: '$rbx', callee-saved-restored: true, debug-info-variable: '',
256 debug-info-expression: '', debug-info-location: '' }
257 - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, stack-id: default,
258 callee-saved-register: '$r12', callee-saved-restored: true, debug-info-variable: '',
259 debug-info-expression: '', debug-info-location: '' }
260 - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, stack-id: default,
261 callee-saved-register: '$r13', callee-saved-restored: true, debug-info-variable: '',
262 debug-info-expression: '', debug-info-location: '' }
263 - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
264 callee-saved-register: '$r14', callee-saved-restored: true, debug-info-variable: '',
265 debug-info-expression: '', debug-info-location: '' }
266 - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: default,
267 callee-saved-register: '$r15', callee-saved-restored: true, debug-info-variable: '',
268 debug-info-expression: '', debug-info-location: '' }
269 - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
270 callee-saved-register: '$rbp', callee-saved-restored: true, debug-info-variable: '',
271 debug-info-expression: '', debug-info-location: '' }
273 - { id: 0, name: '', type: spill-slot, offset: -64, size: 8, alignment: 8,
274 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
275 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
279 successors: %bb.2(0x30000000), %bb.1(0x50000000)
280 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
282 DBG_VALUE $rdi, $noreg, !13, !DIExpression(), debug-location !14
283 DBG_VALUE $rdi, $noreg, !13, !DIExpression(), debug-location !14
284 TEST64rr renamable $rdi, renamable $rdi, implicit-def $eflags, debug-location !15
285 JCC_1 %bb.2, 4, implicit $eflags, debug-location !17
288 successors: %bb.2(0x80000000)
289 liveins: $rdi, $rbp, $r15, $r14, $r13, $r12, $rbx
291 frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
292 CFI_INSTRUCTION def_cfa_offset 16
293 frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp
294 CFI_INSTRUCTION def_cfa_offset 24
295 frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp
296 CFI_INSTRUCTION def_cfa_offset 32
297 frame-setup PUSH64r killed $r13, implicit-def $rsp, implicit $rsp
298 CFI_INSTRUCTION def_cfa_offset 40
299 frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp
300 CFI_INSTRUCTION def_cfa_offset 48
301 frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
302 CFI_INSTRUCTION def_cfa_offset 56
303 CFI_INSTRUCTION offset $rbx, -56
304 CFI_INSTRUCTION offset $r12, -48
305 CFI_INSTRUCTION offset $r13, -40
306 CFI_INSTRUCTION offset $r14, -32
307 CFI_INSTRUCTION offset $r15, -24
308 CFI_INSTRUCTION offset $rbp, -16
309 MOV64mr $rsp, 1, $noreg, -8, $noreg, killed renamable $rdi :: (store 8 into %stack.0)
310 INLINEASM &"", 1, 12, implicit-def dead early-clobber $rax, 12, implicit-def dead early-clobber $rbx, 12, implicit-def dead early-clobber $rcx, 12, implicit-def dead early-clobber $rdx, 12, implicit-def dead early-clobber $rsi, 12, implicit-def dead early-clobber $rdi, 12, implicit-def dead early-clobber $rbp, 12, implicit-def dead early-clobber $r8, 12, implicit-def dead early-clobber $r9, 12, implicit-def dead early-clobber $r10, 12, implicit-def dead early-clobber $r11, 12, implicit-def dead early-clobber $r12, 12, implicit-def dead early-clobber $r13, 12, implicit-def dead early-clobber $r14, 12, implicit-def dead early-clobber $r15, 12, implicit-def dead early-clobber $eflags, !20, debug-location !18
311 renamable $rdi = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load 8 from %stack.0)
312 $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
313 CFI_INSTRUCTION def_cfa_offset 48
314 $r12 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
315 CFI_INSTRUCTION def_cfa_offset 40
316 $r13 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
317 CFI_INSTRUCTION def_cfa_offset 32
318 $r14 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
319 CFI_INSTRUCTION def_cfa_offset 24
320 $r15 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
321 CFI_INSTRUCTION def_cfa_offset 16
322 $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp
323 CFI_INSTRUCTION def_cfa_offset 8
326 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
328 renamable $eax = MOV32rm killed renamable $rdi, 1, $noreg, 4, $noreg, debug-location !23 :: (load 4 from %ir.add.ptr, !tbaa !24)
329 RETQ $eax, debug-location !28
333 # This second function has been appended as a regression test against a
334 # crash, caused by expressions being created from spill restores that did
335 # not preserve fragment information. Test that no empty expressions are
336 # created at all, and the last block describes both variable fragments.
338 # CHECK-LABEL: name: g
339 # CHECK-NOT: !DIExpression()
340 # CHECK-LABEL: bb.2.if.end:
341 # CHECK: DBG_VALUE $rdi, $noreg, ![[QVAR]], !DIExpression(DW_OP_LLVM_fragment, 0, 32)
342 # CHECK-NEXT: DBG_VALUE $rbx, $noreg, ![[QVAR]], !DIExpression(DW_OP_LLVM_fragment, 32, 32)
346 tracksRegLiveness: true
348 - { reg: '$rdi', virtual-reg: '' }
351 offsetAdjustment: -48
353 cvBytesOfCalleeSavedRegisters: 48
356 - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, stack-id: default,
357 callee-saved-register: '$rbx', callee-saved-restored: true, debug-info-variable: '',
358 debug-info-expression: '', debug-info-location: '' }
359 - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, stack-id: default,
360 callee-saved-register: '$r12', callee-saved-restored: true, debug-info-variable: '',
361 debug-info-expression: '', debug-info-location: '' }
362 - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, stack-id: default,
363 callee-saved-register: '$r13', callee-saved-restored: true, debug-info-variable: '',
364 debug-info-expression: '', debug-info-location: '' }
365 - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
366 callee-saved-register: '$r14', callee-saved-restored: true, debug-info-variable: '',
367 debug-info-expression: '', debug-info-location: '' }
368 - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: default,
369 callee-saved-register: '$r15', callee-saved-restored: true, debug-info-variable: '',
370 debug-info-expression: '', debug-info-location: '' }
371 - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
372 callee-saved-register: '$rbp', callee-saved-restored: true, debug-info-variable: '',
373 debug-info-expression: '', debug-info-location: '' }
375 - { id: 0, name: '', type: spill-slot, offset: -64, size: 8, alignment: 8,
376 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
377 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
381 successors: %bb.1(0x50000000)
382 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
384 DBG_VALUE $rdi, $noreg, !113, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !114
385 TEST64rr renamable $rdi, renamable $rdi, implicit-def $eflags, debug-location !115
386 JMP_1 %bb.1, implicit $eflags, debug-location !117
389 successors: %bb.2(0x80000000)
390 liveins: $rdi, $rbp, $r15, $r14, $r13, $r12, $rbx
392 MOV64mr $rsp, 1, $noreg, -8, $noreg, killed renamable $rdi :: (store 8 into %stack.0)
393 renamable $rdi = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load 8 from %stack.0)
396 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
398 DBG_VALUE $rbx, $noreg, !113, !DIExpression(DW_OP_LLVM_fragment, 32, 32), debug-location !114
399 MOV64mr $rsp, 1, $noreg, -8, $noreg, killed renamable $rbx :: (store 8 into %stack.0)
400 renamable $rsi = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load 8 from %stack.0)
402 renamable $eax = MOV32rm killed renamable $rsi, 1, $noreg, 4, $noreg, debug-location !123 :: (load 4 from %ir.add.ptr, !tbaa !24)
404 RETQ $eax, debug-location !128
408 # This third function tests that complex expressions are spilt, and restored
409 # correctly within a basic block.
411 # FIXME: the spilt location below is wrong, there should be a deref between
412 # the spill-offset and the DW_OP_plus_uconst.
414 # CHECK-LABEL: name: h
415 # CHECK-LABEL: bb.0.entry:
416 # CHECK: DBG_VALUE $rdi, $noreg, ![[RVAR]], !DIExpression(DW_OP_plus_uconst, 1)
417 # CHECK-LABEL: bb.1.if.then:
418 # CHECK: DBG_VALUE $rdi, $noreg, ![[RVAR]], !DIExpression(DW_OP_plus_uconst, 1)
419 # CHECK: DBG_VALUE $rsp, 0, ![[RVAR]], !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_plus_uconst, 1)
420 # CHECK: DBG_VALUE $rdi, $noreg, ![[RVAR]], !DIExpression(DW_OP_plus_uconst, 1)
421 # CHECK-LABEL: bb.2.if.end:
422 # CHECK: DBG_VALUE $rdi, $noreg, ![[RVAR]], !DIExpression(DW_OP_plus_uconst, 1)
426 tracksRegLiveness: true
428 - { reg: '$rdi', virtual-reg: '' }
431 offsetAdjustment: -48
433 cvBytesOfCalleeSavedRegisters: 48
436 - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, stack-id: default,
437 callee-saved-register: '$rbx', callee-saved-restored: true, debug-info-variable: '',
438 debug-info-expression: '', debug-info-location: '' }
439 - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, stack-id: default,
440 callee-saved-register: '$r12', callee-saved-restored: true, debug-info-variable: '',
441 debug-info-expression: '', debug-info-location: '' }
442 - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, stack-id: default,
443 callee-saved-register: '$r13', callee-saved-restored: true, debug-info-variable: '',
444 debug-info-expression: '', debug-info-location: '' }
445 - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
446 callee-saved-register: '$r14', callee-saved-restored: true, debug-info-variable: '',
447 debug-info-expression: '', debug-info-location: '' }
448 - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: default,
449 callee-saved-register: '$r15', callee-saved-restored: true, debug-info-variable: '',
450 debug-info-expression: '', debug-info-location: '' }
451 - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
452 callee-saved-register: '$rbp', callee-saved-restored: true, debug-info-variable: '',
453 debug-info-expression: '', debug-info-location: '' }
455 - { id: 0, name: '', type: spill-slot, offset: -64, size: 8, alignment: 8,
456 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
457 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
461 successors: %bb.2(0x30000000), %bb.1(0x50000000)
462 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
464 DBG_VALUE $rdi, $noreg, !213, !DIExpression(DW_OP_plus_uconst, 1), debug-location !214
465 TEST64rr renamable $rdi, renamable $rdi, implicit-def $eflags, debug-location !215
466 JCC_1 %bb.2, 4, implicit $eflags, debug-location !217
469 successors: %bb.2(0x80000000)
470 liveins: $rdi, $rbp, $r15, $r14, $r13, $r12, $rbx
472 frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
473 CFI_INSTRUCTION def_cfa_offset 16
474 frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp
475 CFI_INSTRUCTION def_cfa_offset 24
476 frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp
477 CFI_INSTRUCTION def_cfa_offset 32
478 frame-setup PUSH64r killed $r13, implicit-def $rsp, implicit $rsp
479 CFI_INSTRUCTION def_cfa_offset 40
480 frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp
481 CFI_INSTRUCTION def_cfa_offset 48
482 frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
483 CFI_INSTRUCTION def_cfa_offset 56
484 CFI_INSTRUCTION offset $rbx, -56
485 CFI_INSTRUCTION offset $r12, -48
486 CFI_INSTRUCTION offset $r13, -40
487 CFI_INSTRUCTION offset $r14, -32
488 CFI_INSTRUCTION offset $r15, -24
489 CFI_INSTRUCTION offset $rbp, -16
490 MOV64mr $rsp, 1, $noreg, -8, $noreg, killed renamable $rdi :: (store 8 into %stack.0)
491 INLINEASM &"", 1, 12, implicit-def dead early-clobber $rax, 12, implicit-def dead early-clobber $rbx, 12, implicit-def dead early-clobber $rcx, 12, implicit-def dead early-clobber $rdx, 12, implicit-def dead early-clobber $rsi, 12, implicit-def dead early-clobber $rdi, 12, implicit-def dead early-clobber $rbp, 12, implicit-def dead early-clobber $r8, 12, implicit-def dead early-clobber $r9, 12, implicit-def dead early-clobber $r10, 12, implicit-def dead early-clobber $r11, 12, implicit-def dead early-clobber $r12, 12, implicit-def dead early-clobber $r13, 12, implicit-def dead early-clobber $r14, 12, implicit-def dead early-clobber $r15, 12, implicit-def dead early-clobber $eflags, !220, debug-location !218
492 renamable $rdi = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load 8 from %stack.0)
493 $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
494 CFI_INSTRUCTION def_cfa_offset 48
495 $r12 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
496 CFI_INSTRUCTION def_cfa_offset 40
497 $r13 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
498 CFI_INSTRUCTION def_cfa_offset 32
499 $r14 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
500 CFI_INSTRUCTION def_cfa_offset 24
501 $r15 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
502 CFI_INSTRUCTION def_cfa_offset 16
503 $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp
504 CFI_INSTRUCTION def_cfa_offset 8
507 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
509 renamable $eax = MOV32rm killed renamable $rdi, 1, $noreg, 4, $noreg, debug-location !223 :: (load 4 from %ir.add.ptr, !tbaa !24)
510 RETQ $eax, debug-location !228
516 # Function four: test that spill restores are detected across block
517 # boundaries. The spill has been moved to bb.1, children of which are
518 # bb 2 and 3, neither of which modifies the stack loc. The exit block (3)
519 # should still be tracking the spill, and restore it on stack load.
521 # FIXME: this test too contains a broken spill location.
523 # Summary: loc is in $rdi in bb0, spills to stack in bb1, remains in stack
524 # in bb2, starts in stack then loaded in bb3.
526 # CHECK-LABEL: name: i
527 # CHECK-LABEL: bb.0.entry:
528 # CHECK: DBG_VALUE $rdi, $noreg, ![[SVAR]], !DIExpression(DW_OP_plus_uconst, 1)
529 # CHECK-LABEL: bb.1.foo:
530 # CHECK: DBG_VALUE $rdi, $noreg, ![[SVAR]], !DIExpression(DW_OP_plus_uconst, 1)
531 # CHECK: DBG_VALUE $rsp, 0, ![[SVAR]], !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_plus_uconst, 1)
532 # CHECK-LABEL: bb.2.if.then:
533 # CHECK: DBG_VALUE $rsp, 0, ![[SVAR]], !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_plus_uconst, 1)
534 # CHECK-LABEL: bb.3.if.end
535 # CHECK: DBG_VALUE $rsp, 0, ![[SVAR]], !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_plus_uconst, 1)
536 # CHECK: DBG_VALUE $rdi, $noreg, ![[SVAR]], !DIExpression(DW_OP_plus_uconst, 1)
539 tracksRegLiveness: true
541 - { reg: '$rdi', virtual-reg: '' }
544 offsetAdjustment: -48
546 cvBytesOfCalleeSavedRegisters: 48
549 - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, stack-id: default,
550 callee-saved-register: '$rbx', callee-saved-restored: true, debug-info-variable: '',
551 debug-info-expression: '', debug-info-location: '' }
552 - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, stack-id: default,
553 callee-saved-register: '$r12', callee-saved-restored: true, debug-info-variable: '',
554 debug-info-expression: '', debug-info-location: '' }
555 - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, stack-id: default,
556 callee-saved-register: '$r13', callee-saved-restored: true, debug-info-variable: '',
557 debug-info-expression: '', debug-info-location: '' }
558 - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
559 callee-saved-register: '$r14', callee-saved-restored: true, debug-info-variable: '',
560 debug-info-expression: '', debug-info-location: '' }
561 - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: default,
562 callee-saved-register: '$r15', callee-saved-restored: true, debug-info-variable: '',
563 debug-info-expression: '', debug-info-location: '' }
564 - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
565 callee-saved-register: '$rbp', callee-saved-restored: true, debug-info-variable: '',
566 debug-info-expression: '', debug-info-location: '' }
568 - { id: 0, name: '', type: spill-slot, offset: -64, size: 8, alignment: 8,
569 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
570 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
575 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
577 DBG_VALUE $rdi, $noreg, !313, !DIExpression(DW_OP_plus_uconst, 1), debug-location !314
578 JMP_1 %bb.1, debug-location !317
581 successors: %bb.3(0x30000000), %bb.2(0x50000000)
582 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
585 MOV64mr $rsp, 1, $noreg, -8, $noreg, killed renamable $rdi :: (store 8 into %stack.0)
587 TEST64rr $rax, renamable $rax, implicit-def $eflags, debug-location !315
588 JCC_1 %bb.3, 4, implicit $eflags, debug-location !317
591 successors: %bb.3(0x80000000)
592 liveins: $rbp, $r15, $r14, $r13, $r12, $rbx
594 frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
595 CFI_INSTRUCTION def_cfa_offset 16
596 frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp
597 CFI_INSTRUCTION def_cfa_offset 24
598 frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp
599 CFI_INSTRUCTION def_cfa_offset 32
600 frame-setup PUSH64r killed $r13, implicit-def $rsp, implicit $rsp
601 CFI_INSTRUCTION def_cfa_offset 40
602 frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp
603 CFI_INSTRUCTION def_cfa_offset 48
604 frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
605 CFI_INSTRUCTION def_cfa_offset 56
606 CFI_INSTRUCTION offset $rbx, -56
607 CFI_INSTRUCTION offset $r12, -48
608 CFI_INSTRUCTION offset $r13, -40
609 CFI_INSTRUCTION offset $r14, -32
610 CFI_INSTRUCTION offset $r15, -24
611 CFI_INSTRUCTION offset $rbp, -16
612 INLINEASM &"", 1, 12, implicit-def dead early-clobber $rax, 12, implicit-def dead early-clobber $rbx, 12, implicit-def dead early-clobber $rcx, 12, implicit-def dead early-clobber $rdx, 12, implicit-def dead early-clobber $rsi, 12, implicit-def dead early-clobber $rdi, 12, implicit-def dead early-clobber $rbp, 12, implicit-def dead early-clobber $r8, 12, implicit-def dead early-clobber $r9, 12, implicit-def dead early-clobber $r10, 12, implicit-def dead early-clobber $r11, 12, implicit-def dead early-clobber $r12, 12, implicit-def dead early-clobber $r13, 12, implicit-def dead early-clobber $r14, 12, implicit-def dead early-clobber $r15, 12, implicit-def dead early-clobber $eflags, !320, debug-location !318
613 $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
614 CFI_INSTRUCTION def_cfa_offset 48
615 $r12 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
616 CFI_INSTRUCTION def_cfa_offset 40
617 $r13 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
618 CFI_INSTRUCTION def_cfa_offset 32
619 $r14 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
620 CFI_INSTRUCTION def_cfa_offset 24
621 $r15 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
622 CFI_INSTRUCTION def_cfa_offset 16
623 $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp
624 CFI_INSTRUCTION def_cfa_offset 8
627 liveins: $rbx, $r12, $r13, $r14, $r15, $rbp
629 renamable $rdi = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load 8 from %stack.0)
630 renamable $eax = MOV32rm killed renamable $rdi, 1, $noreg, 4, $noreg, debug-location !323 :: (load 4 from %ir.add.ptr, !tbaa !24)
631 RETQ $eax, debug-location !328
635 # Test that if an unspilt DBG_VALUE starts as an indirect DBG_VALUE, then it
636 # is restored as an indirect DBG_VALUE. FIXME: Note that for the intervening
637 # period of being a spilt location there is still a missing layer of
640 # CHECK-LABEL: name: j
641 # CHECK-LABEL: bb.0.entry:
642 # CHECK: DBG_VALUE $rdi, 0, ![[TVAR]], !DIExpression()
643 # CHECK-LABEL: bb.1.if.then:
644 # CHECK: DBG_VALUE $rsp, 0, ![[TVAR]], !DIExpression(DW_OP_constu, 8, DW_OP_minus)
646 # CHECK: DBG_VALUE ${{[a-zA-Z0-9]+}}, 0, ![[TVAR]], !DIExpression()
647 # CHECK-LABEL: bb.2.if.end
650 tracksRegLiveness: true
652 - { reg: '$rdi', virtual-reg: '' }
655 offsetAdjustment: -48
657 cvBytesOfCalleeSavedRegisters: 48
659 - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, stack-id: default,
660 callee-saved-register: '$rbx', callee-saved-restored: true, debug-info-variable: '',
661 debug-info-expression: '', debug-info-location: '' }
662 - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, stack-id: default,
663 callee-saved-register: '$r12', callee-saved-restored: true, debug-info-variable: '',
664 debug-info-expression: '', debug-info-location: '' }
665 - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, stack-id: default,
666 callee-saved-register: '$r13', callee-saved-restored: true, debug-info-variable: '',
667 debug-info-expression: '', debug-info-location: '' }
668 - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
669 callee-saved-register: '$r14', callee-saved-restored: true, debug-info-variable: '',
670 debug-info-expression: '', debug-info-location: '' }
671 - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: default,
672 callee-saved-register: '$r15', callee-saved-restored: true, debug-info-variable: '',
673 debug-info-expression: '', debug-info-location: '' }
674 - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
675 callee-saved-register: '$rbp', callee-saved-restored: true, debug-info-variable: '',
676 debug-info-expression: '', debug-info-location: '' }
678 - { id: 0, name: '', type: spill-slot, offset: -64, size: 8, alignment: 8,
679 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
680 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
684 successors: %bb.2, %bb.1
685 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
687 DBG_VALUE $rdi, 0, !404, !DIExpression(), debug-location !405
688 DBG_VALUE $rdi, 0, !404, !DIExpression(), debug-location !405
689 TEST64rr renamable $rdi, renamable $rdi, implicit-def $eflags, debug-location !406
690 JCC_1 %bb.2, 4, implicit $eflags, debug-location !408
694 liveins: $rdi, $rbp, $r15, $r14, $r13, $r12, $rbx
696 frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
697 CFI_INSTRUCTION def_cfa_offset 16
698 frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp
699 CFI_INSTRUCTION def_cfa_offset 24
700 frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp
701 CFI_INSTRUCTION def_cfa_offset 32
702 frame-setup PUSH64r killed $r13, implicit-def $rsp, implicit $rsp
703 CFI_INSTRUCTION def_cfa_offset 40
704 frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp
705 CFI_INSTRUCTION def_cfa_offset 48
706 frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
707 CFI_INSTRUCTION def_cfa_offset 56
708 CFI_INSTRUCTION offset $rbx, -56
709 CFI_INSTRUCTION offset $r12, -48
710 CFI_INSTRUCTION offset $r13, -40
711 CFI_INSTRUCTION offset $r14, -32
712 CFI_INSTRUCTION offset $r15, -24
713 CFI_INSTRUCTION offset $rbp, -16
714 MOV64mr $rsp, 1, $noreg, -8, $noreg, killed renamable $rdi :: (store 8 into %stack.0)
715 INLINEASM &"", 1, 12, implicit-def dead early-clobber $rax, 12, implicit-def dead early-clobber $rbx, 12, implicit-def dead early-clobber $rcx, 12, implicit-def dead early-clobber $rdx, 12, implicit-def dead early-clobber $rsi, 12, implicit-def dead early-clobber $rdi, 12, implicit-def dead early-clobber $rbp, 12, implicit-def dead early-clobber $r8, 12, implicit-def dead early-clobber $r9, 12, implicit-def dead early-clobber $r10, 12, implicit-def dead early-clobber $r11, 12, implicit-def dead early-clobber $r12, 12, implicit-def dead early-clobber $r13, 12, implicit-def dead early-clobber $r14, 12, implicit-def dead early-clobber $r15, 12, implicit-def dead early-clobber $eflags, !20, debug-location !409
716 renamable $rdi = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load 8 from %stack.0)
717 $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
718 CFI_INSTRUCTION def_cfa_offset 48
719 $r12 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
720 CFI_INSTRUCTION def_cfa_offset 40
721 $r13 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
722 CFI_INSTRUCTION def_cfa_offset 32
723 $r14 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
724 CFI_INSTRUCTION def_cfa_offset 24
725 $r15 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
726 CFI_INSTRUCTION def_cfa_offset 16
727 $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp
728 CFI_INSTRUCTION def_cfa_offset 8
731 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
733 renamable $eax = MOV32rm killed renamable $rdi, 1, $noreg, 4, $noreg, debug-location !414 :: (load 4 from %ir.add.ptr, !tbaa !24)
734 RETQ $eax, debug-location !415