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
11 # #define FORCE_SPILL() \
12 # __asm volatile("" : : : \
13 # "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "rbp", "r8", \
14 # "r9", "r10", "r11", "r12", "r13", "r14", "r15")
22 # Pick out DILocalVariable numbers for "p", "q" and "r" etc
23 # CHECK: ![[PVAR:[0-9]+]] = !DILocalVariable(name: "p",
24 # CHECK: ![[QVAR:[0-9]+]] = !DILocalVariable(name: "q",
25 # CHECK: ![[RVAR:[0-9]+]] = !DILocalVariable(name: "r",
26 # CHECK: ![[SVAR:[0-9]+]] = !DILocalVariable(name: "s",
28 # Ascertain that the spill has been recognized and manifested in a DBG_VALUE.
29 # CHECK: MOV64mr $rsp,{{.*-8.*}}killed{{.*}}$rdi :: (store 8 into %stack.0)
30 # CHECK-NEXT: DBG_VALUE $rsp,{{.*}}![[PVAR]],{{.*}}!DIExpression(DW_OP_constu, 8, DW_OP_minus)
32 # Check for the restore.
33 # CHECK: $rdi = MOV64rm $rsp,{{.*-8.*}}:: (load 8 from %stack.0)
34 # CHECK-NEXT: DBG_VALUE $rdi,{{.*}}![[PVAR]], !DIExpression()
37 define dso_local i32 @f(i32* readonly %p) local_unnamed_addr !dbg !7 {
39 call void @llvm.dbg.value(metadata i32* %p, metadata !13, metadata !DIExpression()), !dbg !14
40 %tobool = icmp eq i32* %p, null, !dbg !15
41 br i1 %tobool, label %if.end, label %if.then, !dbg !17
43 if.then: ; preds = %entry
44 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
45 br label %if.end, !dbg !21
47 if.end: ; preds = %entry, %if.then
48 %add.ptr = getelementptr inbounds i32, i32* %p, i64 1, !dbg !22
49 %0 = load i32, i32* %add.ptr, align 4, !dbg !23, !tbaa !24
53 define dso_local i32 @g(i32* readonly %p) local_unnamed_addr !dbg !107 {
55 call void @llvm.dbg.value(metadata i32* %p, metadata !113, metadata !DIExpression()), !dbg !114
56 %tobool = icmp eq i32* %p, null, !dbg !115
57 br i1 %tobool, label %if.end, label %if.then, !dbg !117
59 if.then: ; preds = %entry
60 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
61 br label %if.end, !dbg !121
63 if.end: ; preds = %entry, %if.then
64 %add.ptr = getelementptr inbounds i32, i32* %p, i64 1, !dbg !122
65 %0 = load i32, i32* %add.ptr, align 4, !dbg !123, !tbaa !24
69 define dso_local i32 @h(i32* readonly %p) local_unnamed_addr !dbg !207 {
71 call void @llvm.dbg.value(metadata i32* %p, metadata !213, metadata !DIExpression()), !dbg !214
72 %tobool = icmp eq i32* %p, null, !dbg !215
73 br i1 %tobool, label %if.end, label %if.then, !dbg !217
75 if.then: ; preds = %entry
76 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
77 br label %if.end, !dbg !221
79 if.end: ; preds = %entry, %if.then
80 %add.ptr = getelementptr inbounds i32, i32* %p, i64 1, !dbg !222
81 %0 = load i32, i32* %add.ptr, align 4, !dbg !223, !tbaa !24
85 define dso_local i32 @i(i32* readonly %p) local_unnamed_addr !dbg !307 {
90 call void @llvm.dbg.value(metadata i32* %p, metadata !313, metadata !DIExpression()), !dbg !314
91 %tobool = icmp eq i32* %p, null, !dbg !315
92 br i1 %tobool, label %if.end, label %if.then, !dbg !317
94 if.then: ; preds = %entry
95 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
96 br label %if.end, !dbg !321
98 if.end: ; preds = %entry, %if.then
99 %add.ptr = getelementptr inbounds i32, i32* %p, i64 1, !dbg !322
100 %0 = load i32, i32* %add.ptr, align 4, !dbg !323, !tbaa !24
101 ret i32 %0, !dbg !328
104 declare void @llvm.dbg.value(metadata, metadata, metadata)
107 !llvm.module.flags = !{!3, !4, !5}
110 !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)
111 !1 = !DIFile(filename: "test2.c", directory: "/home/test")
113 !3 = !{i32 2, !"Dwarf Version", i32 4}
114 !4 = !{i32 2, !"Debug Info Version", i32 3}
115 !5 = !{i32 1, !"wchar_size", i32 4}
116 !6 = !{!"clang version 9.0.0 (https://git.llvm.org/git/clang.git/ 57a6ce7ac318de98e3e777e09cb9ed8282b5cc03) (https://git.llvm.org/git/llvm.git/ ff54a19e4912d7f15cb02798a7f2048441bff751)"}
117 !7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12)
118 !8 = !DISubroutineType(types: !9)
120 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
121 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64)
123 !13 = !DILocalVariable(name: "p", arg: 1, scope: !7, file: !1, line: 5, type: !11)
124 !14 = !DILocation(line: 5, column: 12, scope: !7)
125 !15 = !DILocation(line: 6, column: 7, scope: !16)
126 !16 = distinct !DILexicalBlock(scope: !7, file: !1, line: 6, column: 7)
127 !17 = !DILocation(line: 6, column: 7, scope: !7)
128 !18 = !DILocation(line: 7, column: 5, scope: !19)
129 !19 = distinct !DILexicalBlock(scope: !16, file: !1, line: 6, column: 10)
130 !20 = !{i32 -2147471544}
131 !21 = !DILocation(line: 8, column: 3, scope: !19)
132 !22 = !DILocation(line: 9, column: 14, scope: !7)
133 !23 = !DILocation(line: 9, column: 10, scope: !7)
134 !24 = !{!25, !25, i64 0}
135 !25 = !{!"int", !26, i64 0}
136 !26 = !{!"omnipotent char", !27, i64 0}
137 !27 = !{!"Simple C/C++ TBAA"}
138 !28 = !DILocation(line: 9, column: 3, scope: !7)
139 !101 = !DIBasicType(name: "looong int", size: 64, encoding: DW_ATE_signed)
140 !107 = distinct !DISubprogram(name: "g", scope: !0, file: !1, line: 105, type: !8, scopeLine: 105, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !112)
142 !113 = !DILocalVariable(name: "q", arg: 1, scope: !107, file: !1, line: 105, type: !101)
143 !114 = !DILocation(line: 105, column: 12, scope: !107)
144 !115 = !DILocation(line: 106, column: 7, scope: !116)
145 !116 = distinct !DILexicalBlock(scope: !107, file: !1, line: 106, column: 7)
146 !117 = !DILocation(line: 106, column: 7, scope: !107)
147 !118 = !DILocation(line: 107, column: 5, scope: !119)
148 !119 = distinct !DILexicalBlock(scope: !116, file: !1, line: 106, column: 10)
149 !120 = !{i32 -2147471544}
150 !121 = !DILocation(line: 108, column: 3, scope: !119)
151 !122 = !DILocation(line: 109, column: 14, scope: !107)
152 !123 = !DILocation(line: 109, column: 10, scope: !107)
153 !128 = !DILocation(line: 109, column: 3, scope: !107)
154 !201 = !DIBasicType(name: "looong int", size: 64, encoding: DW_ATE_signed)
155 !207 = distinct !DISubprogram(name: "g", scope: !0, file: !1, line: 105, type: !8, scopeLine: 105, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !212)
157 !213 = !DILocalVariable(name: "r", arg: 1, scope: !207, file: !1, line: 105, type: !201)
158 !214 = !DILocation(line: 105, column: 12, scope: !207)
159 !215 = !DILocation(line: 106, column: 7, scope: !216)
160 !216 = distinct !DILexicalBlock(scope: !207, file: !1, line: 106, column: 7)
161 !217 = !DILocation(line: 106, column: 7, scope: !207)
162 !218 = !DILocation(line: 107, column: 5, scope: !219)
163 !219 = distinct !DILexicalBlock(scope: !216, file: !1, line: 106, column: 10)
164 !220 = !{i32 -2147471544}
165 !221 = !DILocation(line: 108, column: 3, scope: !219)
166 !222 = !DILocation(line: 109, column: 14, scope: !207)
167 !223 = !DILocation(line: 109, column: 10, scope: !207)
168 !228 = !DILocation(line: 109, column: 3, scope: !207)
169 !301 = !DIBasicType(name: "looong int", size: 64, encoding: DW_ATE_signed)
170 !307 = distinct !DISubprogram(name: "g", scope: !0, file: !1, line: 105, type: !8, scopeLine: 105, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !312)
172 !313 = !DILocalVariable(name: "s", arg: 1, scope: !307, file: !1, line: 105, type: !301)
173 !314 = !DILocation(line: 105, column: 12, scope: !307)
174 !315 = !DILocation(line: 106, column: 7, scope: !316)
175 !316 = distinct !DILexicalBlock(scope: !307, file: !1, line: 106, column: 7)
176 !317 = !DILocation(line: 106, column: 7, scope: !307)
177 !318 = !DILocation(line: 107, column: 5, scope: !319)
178 !319 = distinct !DILexicalBlock(scope: !316, file: !1, line: 106, column: 10)
179 !320 = !{i32 -2147471544}
180 !321 = !DILocation(line: 108, column: 3, scope: !319)
181 !322 = !DILocation(line: 109, column: 14, scope: !307)
182 !323 = !DILocation(line: 109, column: 10, scope: !307)
183 !328 = !DILocation(line: 109, column: 3, scope: !307)
188 exposesReturnsTwice: false
190 regBankSelected: false
193 tracksRegLiveness: true
197 - { reg: '$rdi', virtual-reg: '' }
199 isFrameAddressTaken: false
200 isReturnAddressTaken: false
204 offsetAdjustment: -48
210 cvBytesOfCalleeSavedRegisters: 48
211 hasOpaqueSPAdjustment: false
213 hasMustTailInVarArgFunc: false
218 - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, stack-id: default,
219 callee-saved-register: '$rbx', callee-saved-restored: true, debug-info-variable: '',
220 debug-info-expression: '', debug-info-location: '' }
221 - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, stack-id: default,
222 callee-saved-register: '$r12', callee-saved-restored: true, debug-info-variable: '',
223 debug-info-expression: '', debug-info-location: '' }
224 - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, stack-id: default,
225 callee-saved-register: '$r13', callee-saved-restored: true, debug-info-variable: '',
226 debug-info-expression: '', debug-info-location: '' }
227 - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
228 callee-saved-register: '$r14', callee-saved-restored: true, debug-info-variable: '',
229 debug-info-expression: '', debug-info-location: '' }
230 - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: default,
231 callee-saved-register: '$r15', callee-saved-restored: true, debug-info-variable: '',
232 debug-info-expression: '', debug-info-location: '' }
233 - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
234 callee-saved-register: '$rbp', callee-saved-restored: true, debug-info-variable: '',
235 debug-info-expression: '', debug-info-location: '' }
237 - { id: 0, name: '', type: spill-slot, offset: -64, size: 8, alignment: 8,
238 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
239 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
243 successors: %bb.2(0x30000000), %bb.1(0x50000000)
244 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
246 DBG_VALUE $rdi, $noreg, !13, !DIExpression(), debug-location !14
247 DBG_VALUE $rdi, $noreg, !13, !DIExpression(), debug-location !14
248 TEST64rr renamable $rdi, renamable $rdi, implicit-def $eflags, debug-location !15
249 JCC_1 %bb.2, 4, implicit $eflags, debug-location !17
252 successors: %bb.2(0x80000000)
253 liveins: $rdi, $rbp, $r15, $r14, $r13, $r12, $rbx
255 frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
256 CFI_INSTRUCTION def_cfa_offset 16
257 frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp
258 CFI_INSTRUCTION def_cfa_offset 24
259 frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp
260 CFI_INSTRUCTION def_cfa_offset 32
261 frame-setup PUSH64r killed $r13, implicit-def $rsp, implicit $rsp
262 CFI_INSTRUCTION def_cfa_offset 40
263 frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp
264 CFI_INSTRUCTION def_cfa_offset 48
265 frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
266 CFI_INSTRUCTION def_cfa_offset 56
267 CFI_INSTRUCTION offset $rbx, -56
268 CFI_INSTRUCTION offset $r12, -48
269 CFI_INSTRUCTION offset $r13, -40
270 CFI_INSTRUCTION offset $r14, -32
271 CFI_INSTRUCTION offset $r15, -24
272 CFI_INSTRUCTION offset $rbp, -16
273 MOV64mr $rsp, 1, $noreg, -8, $noreg, killed renamable $rdi :: (store 8 into %stack.0)
274 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
275 renamable $rdi = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load 8 from %stack.0)
276 $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
277 CFI_INSTRUCTION def_cfa_offset 48
278 $r12 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
279 CFI_INSTRUCTION def_cfa_offset 40
280 $r13 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
281 CFI_INSTRUCTION def_cfa_offset 32
282 $r14 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
283 CFI_INSTRUCTION def_cfa_offset 24
284 $r15 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
285 CFI_INSTRUCTION def_cfa_offset 16
286 $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp
287 CFI_INSTRUCTION def_cfa_offset 8
290 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
292 renamable $eax = MOV32rm killed renamable $rdi, 1, $noreg, 4, $noreg, debug-location !23 :: (load 4 from %ir.add.ptr, !tbaa !24)
293 RETQ $eax, debug-location !28
297 # This second function has been appended as a regression test against a
298 # crash, caused by expressions being created from spill restores that did
299 # not preserve fragment information. Test that no empty expressions are
300 # created at all, and the last block describes both variable fragments.
302 # CHECK-LABEL: name: g
303 # CHECK-NOT: !DIExpression()
304 # CHECK-LABEL: bb.2.if.end:
305 # CHECK: DBG_VALUE $rdi, $noreg, ![[QVAR]], !DIExpression(DW_OP_LLVM_fragment, 0, 32)
306 # CHECK-NEXT: DBG_VALUE $rbx, $noreg, ![[QVAR]], !DIExpression(DW_OP_LLVM_fragment, 32, 32)
310 tracksRegLiveness: true
312 - { reg: '$rdi', virtual-reg: '' }
315 offsetAdjustment: -48
317 cvBytesOfCalleeSavedRegisters: 48
320 - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, stack-id: default,
321 callee-saved-register: '$rbx', callee-saved-restored: true, debug-info-variable: '',
322 debug-info-expression: '', debug-info-location: '' }
323 - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, stack-id: default,
324 callee-saved-register: '$r12', callee-saved-restored: true, debug-info-variable: '',
325 debug-info-expression: '', debug-info-location: '' }
326 - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, stack-id: default,
327 callee-saved-register: '$r13', callee-saved-restored: true, debug-info-variable: '',
328 debug-info-expression: '', debug-info-location: '' }
329 - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
330 callee-saved-register: '$r14', callee-saved-restored: true, debug-info-variable: '',
331 debug-info-expression: '', debug-info-location: '' }
332 - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: default,
333 callee-saved-register: '$r15', callee-saved-restored: true, debug-info-variable: '',
334 debug-info-expression: '', debug-info-location: '' }
335 - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
336 callee-saved-register: '$rbp', callee-saved-restored: true, debug-info-variable: '',
337 debug-info-expression: '', debug-info-location: '' }
339 - { id: 0, name: '', type: spill-slot, offset: -64, size: 8, alignment: 8,
340 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
341 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
345 successors: %bb.1(0x50000000)
346 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
348 DBG_VALUE $rdi, $noreg, !113, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !114
349 TEST64rr renamable $rdi, renamable $rdi, implicit-def $eflags, debug-location !115
350 JMP_1 %bb.1, implicit $eflags, debug-location !117
353 successors: %bb.2(0x80000000)
354 liveins: $rdi, $rbp, $r15, $r14, $r13, $r12, $rbx
356 MOV64mr $rsp, 1, $noreg, -8, $noreg, killed renamable $rdi :: (store 8 into %stack.0)
357 renamable $rdi = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load 8 from %stack.0)
360 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
362 DBG_VALUE $rbx, $noreg, !113, !DIExpression(DW_OP_LLVM_fragment, 32, 32), debug-location !114
363 MOV64mr $rsp, 1, $noreg, -8, $noreg, killed renamable $rbx :: (store 8 into %stack.0)
364 renamable $rsi = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load 8 from %stack.0)
366 renamable $eax = MOV32rm killed renamable $rsi, 1, $noreg, 4, $noreg, debug-location !123 :: (load 4 from %ir.add.ptr, !tbaa !24)
368 RETQ $eax, debug-location !128
372 # This third function tests that complex expressions are spilt, and restored
373 # correctly within a basic block.
375 # FIXME: the spilt location below is wrong, there should be a deref between
376 # the spill-offset and the DW_OP_plus_uconst.
378 # CHECK-LABEL: name: h
379 # CHECK-LABEL: bb.0.entry:
380 # CHECK: DBG_VALUE $rdi, $noreg, ![[RVAR]], !DIExpression(DW_OP_plus_uconst, 1)
381 # CHECK-LABEL: bb.1.if.then:
382 # CHECK: DBG_VALUE $rdi, $noreg, ![[RVAR]], !DIExpression(DW_OP_plus_uconst, 1)
383 # CHECK: DBG_VALUE $rsp, 0, ![[RVAR]], !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_plus_uconst, 1)
384 # CHECK: DBG_VALUE $rdi, $noreg, ![[RVAR]], !DIExpression(DW_OP_plus_uconst, 1)
385 # CHECK-LABEL: bb.2.if.end:
386 # CHECK: DBG_VALUE $rdi, $noreg, ![[RVAR]], !DIExpression(DW_OP_plus_uconst, 1)
390 tracksRegLiveness: true
392 - { reg: '$rdi', virtual-reg: '' }
395 offsetAdjustment: -48
397 cvBytesOfCalleeSavedRegisters: 48
400 - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, stack-id: default,
401 callee-saved-register: '$rbx', callee-saved-restored: true, debug-info-variable: '',
402 debug-info-expression: '', debug-info-location: '' }
403 - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, stack-id: default,
404 callee-saved-register: '$r12', callee-saved-restored: true, debug-info-variable: '',
405 debug-info-expression: '', debug-info-location: '' }
406 - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, stack-id: default,
407 callee-saved-register: '$r13', callee-saved-restored: true, debug-info-variable: '',
408 debug-info-expression: '', debug-info-location: '' }
409 - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
410 callee-saved-register: '$r14', callee-saved-restored: true, debug-info-variable: '',
411 debug-info-expression: '', debug-info-location: '' }
412 - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: default,
413 callee-saved-register: '$r15', callee-saved-restored: true, debug-info-variable: '',
414 debug-info-expression: '', debug-info-location: '' }
415 - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
416 callee-saved-register: '$rbp', callee-saved-restored: true, debug-info-variable: '',
417 debug-info-expression: '', debug-info-location: '' }
419 - { id: 0, name: '', type: spill-slot, offset: -64, size: 8, alignment: 8,
420 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
421 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
425 successors: %bb.2(0x30000000), %bb.1(0x50000000)
426 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
428 DBG_VALUE $rdi, $noreg, !213, !DIExpression(DW_OP_plus_uconst, 1), debug-location !214
429 TEST64rr renamable $rdi, renamable $rdi, implicit-def $eflags, debug-location !215
430 JCC_1 %bb.2, 4, implicit $eflags, debug-location !217
433 successors: %bb.2(0x80000000)
434 liveins: $rdi, $rbp, $r15, $r14, $r13, $r12, $rbx
436 frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
437 CFI_INSTRUCTION def_cfa_offset 16
438 frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp
439 CFI_INSTRUCTION def_cfa_offset 24
440 frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp
441 CFI_INSTRUCTION def_cfa_offset 32
442 frame-setup PUSH64r killed $r13, implicit-def $rsp, implicit $rsp
443 CFI_INSTRUCTION def_cfa_offset 40
444 frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp
445 CFI_INSTRUCTION def_cfa_offset 48
446 frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
447 CFI_INSTRUCTION def_cfa_offset 56
448 CFI_INSTRUCTION offset $rbx, -56
449 CFI_INSTRUCTION offset $r12, -48
450 CFI_INSTRUCTION offset $r13, -40
451 CFI_INSTRUCTION offset $r14, -32
452 CFI_INSTRUCTION offset $r15, -24
453 CFI_INSTRUCTION offset $rbp, -16
454 MOV64mr $rsp, 1, $noreg, -8, $noreg, killed renamable $rdi :: (store 8 into %stack.0)
455 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
456 renamable $rdi = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load 8 from %stack.0)
457 $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
458 CFI_INSTRUCTION def_cfa_offset 48
459 $r12 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
460 CFI_INSTRUCTION def_cfa_offset 40
461 $r13 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
462 CFI_INSTRUCTION def_cfa_offset 32
463 $r14 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
464 CFI_INSTRUCTION def_cfa_offset 24
465 $r15 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
466 CFI_INSTRUCTION def_cfa_offset 16
467 $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp
468 CFI_INSTRUCTION def_cfa_offset 8
471 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
473 renamable $eax = MOV32rm killed renamable $rdi, 1, $noreg, 4, $noreg, debug-location !223 :: (load 4 from %ir.add.ptr, !tbaa !24)
474 RETQ $eax, debug-location !228
480 # Function four: test that spill restores are detected across block
481 # boundaries. The spill has been moved to bb.1, children of which are
482 # bb 2 and 3, neither of which modifies the stack loc. The exit block (3)
483 # should still be tracking the spill, and restore it on stack load.
485 # FIXME: this test too contains a broken spill location.
487 # Summary: loc is in $rdi in bb0, spills to stack in bb1, remains in stack
488 # in bb2, starts in stack then loaded in bb3.
490 # CHECK-LABEL: name: i
491 # CHECK-LABEL: bb.0.entry:
492 # CHECK: DBG_VALUE $rdi, $noreg, ![[SVAR]], !DIExpression(DW_OP_plus_uconst, 1)
493 # CHECK-LABEL: bb.1.foo:
494 # CHECK: DBG_VALUE $rdi, $noreg, ![[SVAR]], !DIExpression(DW_OP_plus_uconst, 1)
495 # CHECK: DBG_VALUE $rsp, 0, ![[SVAR]], !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_plus_uconst, 1)
496 # CHECK-LABEL: bb.2.if.then:
497 # CHECK: DBG_VALUE $rsp, 0, ![[SVAR]], !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_plus_uconst, 1)
498 # CHECK-LABEL: bb.3.if.end
499 # CHECK: DBG_VALUE $rsp, 0, ![[SVAR]], !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_plus_uconst, 1)
500 # CHECK: DBG_VALUE $rdi, $noreg, ![[SVAR]], !DIExpression(DW_OP_plus_uconst, 1)
503 tracksRegLiveness: true
505 - { reg: '$rdi', virtual-reg: '' }
508 offsetAdjustment: -48
510 cvBytesOfCalleeSavedRegisters: 48
513 - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, stack-id: default,
514 callee-saved-register: '$rbx', callee-saved-restored: true, debug-info-variable: '',
515 debug-info-expression: '', debug-info-location: '' }
516 - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, stack-id: default,
517 callee-saved-register: '$r12', callee-saved-restored: true, debug-info-variable: '',
518 debug-info-expression: '', debug-info-location: '' }
519 - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, stack-id: default,
520 callee-saved-register: '$r13', callee-saved-restored: true, debug-info-variable: '',
521 debug-info-expression: '', debug-info-location: '' }
522 - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
523 callee-saved-register: '$r14', callee-saved-restored: true, debug-info-variable: '',
524 debug-info-expression: '', debug-info-location: '' }
525 - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: default,
526 callee-saved-register: '$r15', callee-saved-restored: true, debug-info-variable: '',
527 debug-info-expression: '', debug-info-location: '' }
528 - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
529 callee-saved-register: '$rbp', callee-saved-restored: true, debug-info-variable: '',
530 debug-info-expression: '', debug-info-location: '' }
532 - { id: 0, name: '', type: spill-slot, offset: -64, size: 8, alignment: 8,
533 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
534 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
539 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
541 DBG_VALUE $rdi, $noreg, !313, !DIExpression(DW_OP_plus_uconst, 1), debug-location !314
542 JMP_1 %bb.1, debug-location !317
545 successors: %bb.3(0x30000000), %bb.2(0x50000000)
546 liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
549 MOV64mr $rsp, 1, $noreg, -8, $noreg, killed renamable $rdi :: (store 8 into %stack.0)
551 TEST64rr $rax, renamable $rax, implicit-def $eflags, debug-location !315
552 JCC_1 %bb.3, 4, implicit $eflags, debug-location !317
555 successors: %bb.3(0x80000000)
556 liveins: $rbp, $r15, $r14, $r13, $r12, $rbx
558 frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
559 CFI_INSTRUCTION def_cfa_offset 16
560 frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp
561 CFI_INSTRUCTION def_cfa_offset 24
562 frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp
563 CFI_INSTRUCTION def_cfa_offset 32
564 frame-setup PUSH64r killed $r13, implicit-def $rsp, implicit $rsp
565 CFI_INSTRUCTION def_cfa_offset 40
566 frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp
567 CFI_INSTRUCTION def_cfa_offset 48
568 frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
569 CFI_INSTRUCTION def_cfa_offset 56
570 CFI_INSTRUCTION offset $rbx, -56
571 CFI_INSTRUCTION offset $r12, -48
572 CFI_INSTRUCTION offset $r13, -40
573 CFI_INSTRUCTION offset $r14, -32
574 CFI_INSTRUCTION offset $r15, -24
575 CFI_INSTRUCTION offset $rbp, -16
576 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
577 $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
578 CFI_INSTRUCTION def_cfa_offset 48
579 $r12 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
580 CFI_INSTRUCTION def_cfa_offset 40
581 $r13 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
582 CFI_INSTRUCTION def_cfa_offset 32
583 $r14 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
584 CFI_INSTRUCTION def_cfa_offset 24
585 $r15 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
586 CFI_INSTRUCTION def_cfa_offset 16
587 $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp
588 CFI_INSTRUCTION def_cfa_offset 8
591 liveins: $rbx, $r12, $r13, $r14, $r15, $rbp
593 renamable $rdi = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load 8 from %stack.0)
594 renamable $eax = MOV32rm killed renamable $rdi, 1, $noreg, 4, $noreg, debug-location !323 :: (load 4 from %ir.add.ptr, !tbaa !24)
595 RETQ $eax, debug-location !328