1# RUN: llc -o - %s -O0 -regalloc=fast -run-pass=livedebugvalues | \
2# RUN:   FileCheck %s -implicit-check-not=DBG_VALUE
3--- |
4  target triple = "arm64-apple-ios12.1.0"
5
6  declare void @use(i32)
7
8  define void @f1(i32 %x) !dbg !6 {
9  entry:
10    %var = add i32 %x, 1, !dbg !12
11    call void @llvm.dbg.value(metadata i32 %var, metadata !9, metadata !DIExpression()), !dbg !12
12    br label %artificial-bb-1, !dbg !13
13
14  artificial-bb-1:
15    br label %artificial-bb-2
16
17  artificial-bb-2:
18    %invisible = add i32 %var, 1
19    br label %return, !dbg !14
20
21  return:
22    call void @use(i32 %var)
23    ret void, !dbg !15
24  }
25
26  declare void @llvm.dbg.value(metadata, metadata, metadata) #0
27  declare void @llvm.stackprotector(i8*, i8**) #1
28
29  attributes #0 = { nounwind readnone speculatable }
30  attributes #1 = { nounwind }
31
32  !llvm.dbg.cu = !{!0}
33  !llvm.debugify = !{!3, !4}
34  !llvm.module.flags = !{!5}
35
36  !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
37  !1 = !DIFile(filename: "compiler-gen-bbs-livedebugvalues.ll", directory: "/")
38  !2 = !{}
39  !3 = !{i32 6}
40  !4 = !{i32 2}
41  !5 = !{i32 2, !"Debug Info Version", i32 3}
42  !6 = distinct !DISubprogram(name: "f1", linkageName: "f1", scope: null, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !8)
43  !7 = !DISubroutineType(types: !2)
44  !8 = !{!9, !11}
45  !9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10)
46  !10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
47  !11 = !DILocalVariable(name: "2", scope: !6, file: !1, line: 4, type: !10)
48  !12 = !DILocation(line: 1, column: 1, scope: !6)
49  !13 = !DILocation(line: 2, column: 1, scope: !6)
50  !14 = !DILocation(line: 0, column: 1, scope: !6)
51  !15 = !DILocation(line: 4, column: 1, scope: !6)
52
53...
54---
55# CHECK-LABEL: name: f1
56name:            f1
57alignment:       2
58legalized:       true
59regBankSelected: true
60selected:        true
61tracksRegLiveness: true
62frameInfo:
63  stackSize:       32
64  maxAlignment:    8
65  adjustsStack:    true
66  hasCalls:        true
67  maxCallFrameSize: 0
68stack:
69  - { id: 0, type: spill-slot, offset: -20, size: 4, alignment: 4, stack-id: default }
70  - { id: 1, type: spill-slot, offset: -8, size: 8, alignment: 8, stack-id: default,
71      callee-saved-register: '$lr' }
72  - { id: 2, type: spill-slot, offset: -16, size: 8, alignment: 8, stack-id: default,
73      callee-saved-register: '$fp' }
74body:             |
75  ; CHECK-LABEL: bb.0.entry:
76  bb.0.entry:
77    liveins: $w0, $lr
78
79    $sp = frame-setup SUBXri $sp, 32, 0
80    frame-setup STPXi killed $fp, killed $lr, $sp, 2 :: (store 8 into %stack.2), (store 8 into %stack.1)
81    frame-setup CFI_INSTRUCTION def_cfa_offset 32
82    frame-setup CFI_INSTRUCTION offset $w30, -8, debug-location !12
83    frame-setup CFI_INSTRUCTION offset $w29, -16, debug-location !12
84    renamable $w0 = ADDWri killed renamable $w0, 1, 0, debug-location !12
85    DBG_VALUE renamable $w0, $noreg, !9, !DIExpression(), debug-location !12
86    STRWui killed $w0, $sp, 3 :: (store 4 into %stack.0)
87    DBG_VALUE $sp, 0, !9, !DIExpression(DW_OP_plus_uconst, 12), debug-location !12
88
89    ; CHECK: DBG_VALUE renamable $w0, $noreg, !9, !DIExpression(), debug-location !12
90    ; CHECK-NEXT: STRWui killed $w0, $sp, 3 :: (store 4 into %stack.0)
91    ; CHECK-NEXT: DBG_VALUE $sp, 0, !9, !DIExpression(DW_OP_plus_uconst, 12)
92
93  bb.1.artificial-bb-1:
94    ; CHECK-LABEL: bb.1.artificial-bb-1:
95    ; CHECK: DBG_VALUE $sp, 0, !9, !DIExpression(DW_OP_plus_uconst, 12)
96
97  bb.2.artificial-bb-2:
98    ; CHECK-LABEL: bb.2.artificial-bb-2:
99    ; CHECK: DBG_VALUE $sp, 0, !9, !DIExpression(DW_OP_plus_uconst, 12)
100
101  bb.3.return:
102    ; CHECK-LABEL: bb.3.return:
103    ; CHECK: DBG_VALUE $sp, 0, !9, !DIExpression(DW_OP_plus_uconst, 12)
104
105    $w0 = LDRWui $sp, 3 :: (load 4 from %stack.0)
106    BL @use, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit killed $w0
107    $fp, $lr = frame-destroy LDPXi $sp, 2, debug-location !15 :: (load 8 from %stack.2), (load 8 from %stack.1)
108    $sp = frame-destroy ADDXri $sp, 32, 0, debug-location !15
109    RET undef $lr, debug-location !15
110...
111