|
14 | 14 | # return *(p + 1);
|
15 | 15 | # }
|
16 | 16 |
|
| 17 | +# Pick out DILocalVariable numbers for "p" and "q" |
| 18 | +# CHECK: ![[PVAR:[0-9]+]] = !DILocalVariable(name: "p", |
| 19 | +# CHECK: ![[QVAR:[0-9]+]] = !DILocalVariable(name: "q", |
| 20 | + |
17 | 21 | # Ascertain that the spill has been recognized and manifested in a DBG_VALUE.
|
18 | 22 | # CHECK: MOV64mr $rsp,{{.*-8.*}}killed{{.*}}$rdi :: (store 8 into %stack.0)
|
19 |
| -# CHECK-NEXT: DBG_VALUE $rsp,{{.*}}![[MDIX:[0-9]+]],{{.*}}!DIExpression(DW_OP_constu, 8, DW_OP_minus) |
| 23 | +# CHECK-NEXT: DBG_VALUE $rsp,{{.*}}![[PVAR]],{{.*}}!DIExpression(DW_OP_constu, 8, DW_OP_minus) |
20 | 24 |
|
21 | 25 | # Check for the restore.
|
22 | 26 | # CHECK: $rdi = MOV64rm $rsp,{{.*-8.*}}:: (load 8 from %stack.0)
|
23 |
| -# CHECK-NEXT: DBG_VALUE $rdi,{{.*}}![[MDIX]], !DIExpression() |
| 27 | +# CHECK-NEXT: DBG_VALUE $rdi,{{.*}}![[PVAR]], !DIExpression() |
24 | 28 |
|
25 | 29 | --- |
|
26 | 30 | define dso_local i32 @f(i32* readonly %p) local_unnamed_addr !dbg !7 {
|
|
39 | 43 | ret i32 %0, !dbg !28
|
40 | 44 | }
|
41 | 45 |
|
| 46 | + define dso_local i32 @g(i32* readonly %p) local_unnamed_addr !dbg !107 { |
| 47 | + entry: |
| 48 | + call void @llvm.dbg.value(metadata i32* %p, metadata !113, metadata !DIExpression()), !dbg !114 |
| 49 | + %tobool = icmp eq i32* %p, null, !dbg !115 |
| 50 | + br i1 %tobool, label %if.end, label %if.then, !dbg !117 |
| 51 | + |
| 52 | + if.then: ; preds = %entry |
| 53 | + 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 |
| 54 | + br label %if.end, !dbg !121 |
| 55 | + |
| 56 | + if.end: ; preds = %entry, %if.then |
| 57 | + %add.ptr = getelementptr inbounds i32, i32* %p, i64 1, !dbg !122 |
| 58 | + %0 = load i32, i32* %add.ptr, align 4, !dbg !123, !tbaa !24 |
| 59 | + ret i32 %0, !dbg !128 |
| 60 | + } |
| 61 | + |
42 | 62 | declare void @llvm.dbg.value(metadata, metadata, metadata)
|
43 | 63 |
|
44 | 64 | !llvm.dbg.cu = !{!0}
|
|
74 | 94 | !26 = !{!"omnipotent char", !27, i64 0}
|
75 | 95 | !27 = !{!"Simple C/C++ TBAA"}
|
76 | 96 | !28 = !DILocation(line: 9, column: 3, scope: !7)
|
| 97 | + !101 = !DIBasicType(name: "looong int", size: 64, encoding: DW_ATE_signed) |
| 98 | + !107 = distinct !DISubprogram(name: "g", scope: !1, file: !1, line: 105, type: !8, scopeLine: 105, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !112) |
| 99 | + !112 = !{!113} |
| 100 | + !113 = !DILocalVariable(name: "q", arg: 1, scope: !107, file: !1, line: 105, type: !101) |
| 101 | + !114 = !DILocation(line: 105, column: 12, scope: !107) |
| 102 | + !115 = !DILocation(line: 106, column: 7, scope: !116) |
| 103 | + !116 = distinct !DILexicalBlock(scope: !107, file: !1, line: 106, column: 7) |
| 104 | + !117 = !DILocation(line: 106, column: 7, scope: !107) |
| 105 | + !118 = !DILocation(line: 107, column: 5, scope: !119) |
| 106 | + !119 = distinct !DILexicalBlock(scope: !116, file: !1, line: 106, column: 10) |
| 107 | + !120 = !{i32 -2147471544} |
| 108 | + !121 = !DILocation(line: 108, column: 3, scope: !119) |
| 109 | + !122 = !DILocation(line: 109, column: 14, scope: !107) |
| 110 | + !123 = !DILocation(line: 109, column: 10, scope: !107) |
| 111 | + !128 = !DILocation(line: 109, column: 3, scope: !107) |
| 112 | + |
77 | 113 |
|
78 | 114 | ...
|
79 | 115 | ---
|
@@ -187,3 +223,78 @@ body: |
|
187 | 223 | RETQ $eax, debug-location !28
|
188 | 224 |
|
189 | 225 | ...
|
| 226 | +--- |
| 227 | +# This second function has been appended as a regression test against a |
| 228 | +# crash, caused by expressions being created from spill restores that did |
| 229 | +# not preserve fragment information. Test that no empty expressions are |
| 230 | +# created at all, and the last block describes both variable fragments. |
| 231 | + |
| 232 | +# CHECK-LABEL: name: g |
| 233 | +# CHECK-NOT: !DIExpression() |
| 234 | +# CHECK-LABEL: bb.2.if.end: |
| 235 | +# CHECK: DBG_VALUE $rdi, $noreg, ![[QVAR]], !DIExpression(DW_OP_LLVM_fragment, 0, 32) |
| 236 | +# CHECK-NEXT: DBG_VALUE $rbx, $noreg, ![[QVAR]], !DIExpression(DW_OP_LLVM_fragment, 32, 32) |
| 237 | + |
| 238 | +name: g |
| 239 | +alignment: 4 |
| 240 | +tracksRegLiveness: true |
| 241 | +liveins: |
| 242 | + - { reg: '$rdi', virtual-reg: '' } |
| 243 | +frameInfo: |
| 244 | + stackSize: 48 |
| 245 | + offsetAdjustment: -48 |
| 246 | + maxAlignment: 8 |
| 247 | + cvBytesOfCalleeSavedRegisters: 48 |
| 248 | + localFrameSize: 0 |
| 249 | +fixedStack: |
| 250 | + - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, stack-id: default, |
| 251 | + callee-saved-register: '$rbx', callee-saved-restored: true, debug-info-variable: '', |
| 252 | + debug-info-expression: '', debug-info-location: '' } |
| 253 | + - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, stack-id: default, |
| 254 | + callee-saved-register: '$r12', callee-saved-restored: true, debug-info-variable: '', |
| 255 | + debug-info-expression: '', debug-info-location: '' } |
| 256 | + - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, stack-id: default, |
| 257 | + callee-saved-register: '$r13', callee-saved-restored: true, debug-info-variable: '', |
| 258 | + debug-info-expression: '', debug-info-location: '' } |
| 259 | + - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default, |
| 260 | + callee-saved-register: '$r14', callee-saved-restored: true, debug-info-variable: '', |
| 261 | + debug-info-expression: '', debug-info-location: '' } |
| 262 | + - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: default, |
| 263 | + callee-saved-register: '$r15', callee-saved-restored: true, debug-info-variable: '', |
| 264 | + debug-info-expression: '', debug-info-location: '' } |
| 265 | + - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default, |
| 266 | + callee-saved-register: '$rbp', callee-saved-restored: true, debug-info-variable: '', |
| 267 | + debug-info-expression: '', debug-info-location: '' } |
| 268 | +stack: |
| 269 | + - { id: 0, name: '', type: spill-slot, offset: -64, size: 8, alignment: 8, |
| 270 | + stack-id: default, callee-saved-register: '', callee-saved-restored: true, |
| 271 | + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } |
| 272 | +constants: [] |
| 273 | +body: | |
| 274 | + bb.0.entry: |
| 275 | + successors: %bb.1(0x50000000) |
| 276 | + liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp |
| 277 | + |
| 278 | + DBG_VALUE $rdi, $noreg, !113, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !114 |
| 279 | + TEST64rr renamable $rdi, renamable $rdi, implicit-def $eflags, debug-location !115 |
| 280 | + JMP_1 %bb.1, implicit $eflags, debug-location !117 |
| 281 | + |
| 282 | + bb.1.if.then: |
| 283 | + successors: %bb.2(0x80000000) |
| 284 | + liveins: $rdi, $rbp, $r15, $r14, $r13, $r12, $rbx |
| 285 | + |
| 286 | + MOV64mr $rsp, 1, $noreg, -8, $noreg, killed renamable $rdi :: (store 8 into %stack.0) |
| 287 | + renamable $rdi = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load 8 from %stack.0) |
| 288 | + |
| 289 | + bb.2.if.end: |
| 290 | + liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp |
| 291 | + |
| 292 | + DBG_VALUE $rbx, $noreg, !113, !DIExpression(DW_OP_LLVM_fragment, 32, 32), debug-location !114 |
| 293 | + MOV64mr $rsp, 1, $noreg, -8, $noreg, killed renamable $rbx :: (store 8 into %stack.0) |
| 294 | + renamable $rsi = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load 8 from %stack.0) |
| 295 | +
|
| 296 | + renamable $eax = MOV32rm killed renamable $rsi, 1, $noreg, 4, $noreg, debug-location !123 :: (load 4 from %ir.add.ptr, !tbaa !24) |
| 297 | + $rdi = MOV64ri 0 |
| 298 | + RETQ $eax, debug-location !128 |
| 299 | +
|
| 300 | +... |
0 commit comments