1 # RUN: llc -mtriple=arm-eabi -run-pass=livedebugvalues %s -o - | FileCheck %s
3 # Check that the debug information for variables are propagated into the correct blocks.
5 # Generated from the C source:
9 # int b = func2(10, 11);
11 # int c = func2(12, 13);
12 # for(int i = 1; i < a; i++) {
20 # CHECK: [[VAR_A:![0-9]+]] = !DILocalVariable(name: "a",
21 # CHECK: [[VAR_B:![0-9]+]] = !DILocalVariable(name: "b",
22 # CHECK: [[VAR_C:![0-9]+]] = !DILocalVariable(name: "c",
23 # CHECK: [[VAR_I:![0-9]+]] = !DILocalVariable(name: "i",
26 # CHECK: DBG_VALUE $r0, $noreg, [[VAR_A]]
27 # CHECK: DBG_VALUE [[REG_A:\$r[0-9]+]], $noreg, [[VAR_A]]
28 # CHECK: DBG_VALUE [[REG_B:\$r[0-9]+]], $noreg, [[VAR_B]]
31 # CHECK: DBG_VALUE [[REG_B]], $noreg, [[VAR_B]]
32 # CHECK: DBG_VALUE [[REG_A]], $noreg, [[VAR_A]]
33 # CHECK: DBG_VALUE [[REG_C:\$r[0-9]+]], $noreg, [[VAR_C]]
34 # CHECK: DBG_VALUE 1, 0, [[VAR_I]]
36 # CHECK: bb.2.for.body
37 # CHECK: DBG_VALUE [[REG_I:\$r[0-9]+]], $noreg, [[VAR_I]]
38 # CHECK: DBG_VALUE [[REG_C]], $noreg, [[VAR_C]]
39 # CHECK: DBG_VALUE [[REG_B]], $noreg, [[VAR_B]]
40 # CHECK: DBG_VALUE [[REG_A]], $noreg, [[VAR_A]]
41 # CHECK: DBG_VALUE [[REG_I]], $noreg, [[VAR_I]]
43 # CHECK: bb.3.for.cond
44 # CHECK: DBG_VALUE [[REG_C]], $noreg, [[VAR_C]]
45 # CHECK: DBG_VALUE [[REG_B]], $noreg, [[VAR_B]]
46 # CHECK: DBG_VALUE [[REG_A]], $noreg, [[VAR_A]]
47 # CHECK: DBG_VALUE [[REG_I]], $noreg, [[VAR_I]]
49 # CHECK: bb.4.for.cond.cleanup
50 # CHECK: DBG_VALUE [[REG_C]], $noreg, [[VAR_C]]
51 # CHECK: DBG_VALUE [[REG_B]], $noreg, [[VAR_B]]
52 # CHECK: DBG_VALUE [[REG_A]], $noreg, [[VAR_A]]
55 # CHECK: DBG_VALUE [[REG_B]], $noreg, [[VAR_B]]
56 # CHECK: DBG_VALUE [[REG_A]], $noreg, [[VAR_A]]
58 ; ModuleID = '/data/kwalker/work/OpenSource-llvm/llvm/test/CodeGen/ARM/dbg-range-extension.ll'
59 source_filename = "/data/kwalker/work/OpenSource-llvm/llvm/test/CodeGen/ARM/dbg-range-extension.ll"
60 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
61 target triple = "arm---eabi"
63 ; Function Attrs: minsize nounwind optsize
64 define void @func(i32 %a) local_unnamed_addr #0 !dbg !8 {
66 tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !13, metadata !20), !dbg !21
67 %call = tail call i32 @func2(i32 10, i32 11) #0, !dbg !22
68 tail call void @llvm.dbg.value(metadata i32 %call, i64 0, metadata !14, metadata !20), !dbg !23
69 %tobool = icmp eq i32 %a, 0, !dbg !24
70 br i1 %tobool, label %if.end, label %if.then, !dbg !25
72 if.then: ; preds = %entry
73 %call1 = tail call i32 @func2(i32 12, i32 13) #0, !dbg !26
74 tail call void @llvm.dbg.value(metadata i32 %call1, i64 0, metadata !15, metadata !20), !dbg !27
75 tail call void @llvm.dbg.value(metadata i32 1, i64 0, metadata !18, metadata !20), !dbg !28
76 br label %for.cond, !dbg !29
78 for.cond: ; preds = %for.body, %if.then
79 %i.0 = phi i32 [ 1, %if.then ], [ %inc, %for.body ]
80 tail call void @llvm.dbg.value(metadata i32 %i.0, i64 0, metadata !18, metadata !20), !dbg !28
81 %cmp = icmp slt i32 %i.0, %a, !dbg !30
82 br i1 %cmp, label %for.body, label %for.cond.cleanup, !dbg !33
84 for.cond.cleanup: ; preds = %for.cond
85 %call3 = tail call i32 @func2(i32 %call, i32 %call1) #0, !dbg !34
86 br label %if.end, !dbg !35
88 for.body: ; preds = %for.cond
89 %0 = add i32 %call, %i.0, !dbg !36
90 %call2 = tail call i32 @func2(i32 %i.0, i32 %0) #0, !dbg !36
91 %inc = add nuw nsw i32 %i.0, 1, !dbg !38
92 tail call void @llvm.dbg.value(metadata i32 %inc, i64 0, metadata !18, metadata !20), !dbg !28
93 br label %for.cond, !dbg !40, !llvm.loop !41
95 if.end: ; preds = %for.cond.cleanup, %entry
96 %call4 = tail call i32 @func2(i32 %call, i32 %a) #0, !dbg !43
100 ; Function Attrs: minsize optsize
101 declare i32 @func2(i32, i32) local_unnamed_addr #1
103 ; Function Attrs: nounwind readnone
104 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
106 ; Function Attrs: nounwind
107 declare void @llvm.stackprotector(i8*, i8**) #3
109 attributes #0 = { minsize nounwind optsize }
110 attributes #1 = { minsize optsize }
111 attributes #2 = { nounwind readnone }
112 attributes #3 = { nounwind }
115 !llvm.module.flags = !{!3, !4, !5, !6}
118 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
119 !1 = !DIFile(filename: "loop.c", directory: "/tmp")
121 !3 = !{i32 2, !"Dwarf Version", i32 4}
122 !4 = !{i32 2, !"Debug Info Version", i32 3}
123 !5 = !{i32 1, !"wchar_size", i32 4}
124 !6 = !{i32 1, !"min_enum_size", i32 4}
125 !7 = !{!"clang version 4.0.0"}
126 !8 = distinct !DISubprogram(name: "func", scope: !1, file: !1, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12)
127 !9 = !DISubroutineType(types: !10)
129 !11 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
130 !12 = !{!13, !14, !15, !18}
131 !13 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !1, line: 2, type: !11)
132 !14 = !DILocalVariable(name: "b", scope: !8, file: !1, line: 3, type: !11)
133 !15 = !DILocalVariable(name: "c", scope: !16, file: !1, line: 5, type: !11)
134 !16 = distinct !DILexicalBlock(scope: !17, file: !1, line: 4, column: 9)
135 !17 = distinct !DILexicalBlock(scope: !8, file: !1, line: 4, column: 6)
136 !18 = !DILocalVariable(name: "i", scope: !19, file: !1, line: 6, type: !11)
137 !19 = distinct !DILexicalBlock(scope: !16, file: !1, line: 6, column: 3)
138 !20 = !DIExpression()
139 !21 = !DILocation(line: 2, column: 15, scope: !8)
140 !22 = !DILocation(line: 3, column: 17, scope: !8)
141 !23 = !DILocation(line: 3, column: 13, scope: !8)
142 !24 = !DILocation(line: 4, column: 6, scope: !17)
143 !25 = !DILocation(line: 4, column: 6, scope: !8)
144 !26 = !DILocation(line: 5, column: 11, scope: !16)
145 !27 = !DILocation(line: 5, column: 7, scope: !16)
146 !28 = !DILocation(line: 6, column: 11, scope: !19)
147 !29 = !DILocation(line: 6, column: 7, scope: !19)
148 !30 = !DILocation(line: 6, column: 20, scope: !31)
149 !31 = !DILexicalBlockFile(scope: !32, file: !1, discriminator: 1)
150 !32 = distinct !DILexicalBlock(scope: !19, file: !1, line: 6, column: 3)
151 !33 = !DILocation(line: 6, column: 3, scope: !31)
152 !34 = !DILocation(line: 9, column: 3, scope: !16)
153 !35 = !DILocation(line: 10, column: 2, scope: !16)
154 !36 = !DILocation(line: 7, column: 4, scope: !37)
155 !37 = distinct !DILexicalBlock(scope: !32, file: !1, line: 6, column: 30)
156 !38 = !DILocation(line: 6, column: 26, scope: !39)
157 !39 = !DILexicalBlockFile(scope: !32, file: !1, discriminator: 3)
158 !40 = !DILocation(line: 6, column: 3, scope: !39)
159 !41 = distinct !{!41, !42}
160 !42 = !DILocation(line: 6, column: 3, scope: !16)
161 !43 = !DILocation(line: 11, column: 2, scope: !8)
162 !44 = !DILocation(line: 12, column: 1, scope: !8)
168 exposesReturnsTwice: false
170 regBankSelected: false
172 tracksRegLiveness: false
175 calleeSavedRegisters: [ '$lr', '$d8', '$d9', '$d10', '$d11', '$d12', '$d13',
176 '$d14', '$d15', '$q4', '$q5', '$q6', '$q7', '$r4',
177 '$r5', '$r6', '$r7', '$r8', '$r9', '$r10', '$r11',
178 '$s16', '$s17', '$s18', '$s19', '$s20', '$s21',
179 '$s22', '$s23', '$s24', '$s25', '$s26', '$s27',
180 '$s28', '$s29', '$s30', '$s31', '$d8_d10', '$d9_d11',
181 '$d10_d12', '$d11_d13', '$d12_d14', '$d13_d15',
182 '$q4_q5', '$q5_q6', '$q6_q7', '$q4_q5_q6_q7', '$r4_r5',
183 '$r6_r7', '$r8_r9', '$r10_r11', '$d8_d9_d10', '$d9_d10_d11',
184 '$d10_d11_d12', '$d11_d12_d13', '$d12_d13_d14',
185 '$d13_d14_d15', '$d8_d10_d12', '$d9_d11_d13', '$d10_d12_d14',
186 '$d11_d13_d15', '$d8_d10_d12_d14', '$d9_d11_d13_d15',
187 '$d9_d10', '$d11_d12', '$d13_d14', '$d9_d10_d11_d12',
190 isFrameAddressTaken: false
191 isReturnAddressTaken: false
200 hasOpaqueSPAdjustment: false
202 hasMustTailInVarArgFunc: false
204 - { id: 0, type: spill-slot, offset: -4, size: 4, alignment: 4, callee-saved-register: '$lr' }
205 - { id: 1, type: spill-slot, offset: -8, size: 4, alignment: 4, callee-saved-register: '$r11' }
206 - { id: 2, type: spill-slot, offset: -12, size: 4, alignment: 4, callee-saved-register: '$r7' }
207 - { id: 3, type: spill-slot, offset: -16, size: 4, alignment: 4, callee-saved-register: '$r6' }
208 - { id: 4, type: spill-slot, offset: -20, size: 4, alignment: 4, callee-saved-register: '$r5' }
209 - { id: 5, type: spill-slot, offset: -24, size: 4, alignment: 4, callee-saved-register: '$r4' }
212 liveins: $r0, $r4, $r5, $r6, $r7, $r11, $lr
214 $sp = frame-setup STMDB_UPD $sp, 14, $noreg, killed $r4, killed $r5, killed $r6, killed $r7, killed $r11, killed $lr
215 frame-setup CFI_INSTRUCTION def_cfa_offset 24
216 frame-setup CFI_INSTRUCTION offset $lr, -4
217 frame-setup CFI_INSTRUCTION offset $r11, -8
218 frame-setup CFI_INSTRUCTION offset $r7, -12
219 frame-setup CFI_INSTRUCTION offset $r6, -16
220 frame-setup CFI_INSTRUCTION offset $r5, -20
221 frame-setup CFI_INSTRUCTION offset $r4, -24
222 DBG_VALUE $r0, $noreg, !13, !20, debug-location !21
223 $r4 = MOVr killed $r0, 14, $noreg, $noreg
224 DBG_VALUE $r4, $noreg, !13, !20, debug-location !21
225 $r0 = MOVi 10, 14, $noreg, _, debug-location !22
226 $r1 = MOVi 11, 14, $noreg, _, debug-location !22
227 BL @func2, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit killed $r1, implicit-def $sp, implicit-def $r0, debug-location !22
228 $r5 = MOVr killed $r0, 14, $noreg, _, debug-location !22
229 DBG_VALUE $r5, $noreg, !14, !20, debug-location !23
230 CMPri $r4, 0, 14, $noreg, implicit-def $cpsr, debug-location !25
231 Bcc %bb.5.if.end, 0, killed $cpsr
236 $r0 = MOVi 12, 14, $noreg, _, debug-location !26
237 $r1 = MOVi 13, 14, $noreg, _, debug-location !26
238 BL @func2, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit killed $r1, implicit-def $sp, implicit-def $r0, debug-location !26
239 $r6 = MOVr killed $r0, 14, $noreg, _, debug-location !26
240 DBG_VALUE $r6, $noreg, !15, !20, debug-location !27
241 $r7 = MOVi 1, 14, $noreg, $noreg
242 DBG_VALUE 1, 0, !18, !20, debug-location !28
246 liveins: $r4, $r5, $r6, $r7
248 $r1 = ADDrr $r5, $r7, 14, $noreg, _, debug-location !36
249 $r0 = MOVr $r7, 14, $noreg, _, debug-location !36
250 BL @func2, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit killed $r1, implicit-def $sp, implicit-def dead $r0, debug-location !36
251 $r7 = ADDri killed $r7, 1, 14, $noreg, _, debug-location !38
252 DBG_VALUE $r7, $noreg, !18, !20, debug-location !28
255 liveins: $r4, $r5, $r6, $r7
257 DBG_VALUE $r7, $noreg, !18, !20, debug-location !28
258 CMPrr $r7, $r4, 14, $noreg, implicit-def $cpsr, debug-location !33
259 Bcc %bb.2.for.body, 11, killed $cpsr, debug-location !33
261 bb.4.for.cond.cleanup:
262 liveins: $r4, $r5, $r6
264 $r0 = MOVr $r5, 14, $noreg, _, debug-location !34
265 $r1 = MOVr killed $r6, 14, $noreg, _, debug-location !34
266 BL @func2, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit killed $r1, implicit-def $sp, implicit-def dead $r0, debug-location !34
271 $r0 = MOVr killed $r5, 14, $noreg, _, debug-location !43
272 $r1 = MOVr killed $r4, 14, $noreg, _, debug-location !43
273 $sp = LDMIA_UPD $sp, 14, $noreg, def $r4, def $r5, def $r6, def $r7, def $r11, def $lr, debug-location !43
274 TAILJMPd @func2, implicit $sp, implicit $sp, implicit killed $r0, implicit killed $r1, debug-location !43