278 lines · plain
1# RUN: llc -mtriple=arm-eabi -run-pass=livedebugvalues %s -o - | FileCheck %s2# RUN: llc -mtriple=arm-eabi -passes=live-debug-values %s -o - | FileCheck %s3#4# Check that the debug information for variables are propagated into the correct blocks.5#6# Generated from the C source:7#8# int func2(int, int);9# void func(int a) {10# int b = func2(10, 11);11# if (a) {12# int c = func2(12, 13);13# for(int i = 1; i < a; i++) {14# func2(i, i+b);15# }16# func2(b,c);17# }18# func2(b,a);19# }20 21# CHECK: [[VAR_A:![0-9]+]] = !DILocalVariable(name: "a",22# CHECK: [[VAR_B:![0-9]+]] = !DILocalVariable(name: "b",23# CHECK: [[VAR_C:![0-9]+]] = !DILocalVariable(name: "c",24# CHECK: [[VAR_I:![0-9]+]] = !DILocalVariable(name: "i",25 26# CHECK: bb.0.entry27# CHECK: DBG_VALUE $r0, $noreg, [[VAR_A]]28# CHECK: DBG_VALUE [[REG_A:\$r[0-9]+]], $noreg, [[VAR_A]]29# CHECK: DBG_VALUE [[REG_B:\$r[0-9]+]], $noreg, [[VAR_B]]30 31# CHECK: bb.1.if.then32# CHECK: DBG_VALUE [[REG_B]], $noreg, [[VAR_B]]33# CHECK: DBG_VALUE [[REG_A]], $noreg, [[VAR_A]]34# CHECK: DBG_VALUE [[REG_C:\$r[0-9]+]], $noreg, [[VAR_C]]35# CHECK: DBG_VALUE 1, 0, [[VAR_I]]36 37# CHECK: bb.2.for.body38# CHECK: DBG_VALUE [[REG_I:\$r[0-9]+]], $noreg, [[VAR_I]]39# CHECK: DBG_VALUE [[REG_C]], $noreg, [[VAR_C]]40# CHECK: DBG_VALUE [[REG_B]], $noreg, [[VAR_B]]41# CHECK: DBG_VALUE [[REG_A]], $noreg, [[VAR_A]]42# CHECK: DBG_VALUE [[REG_I]], $noreg, [[VAR_I]]43 44# CHECK: bb.3.for.cond45# CHECK: DBG_VALUE [[REG_C]], $noreg, [[VAR_C]]46# CHECK: DBG_VALUE [[REG_B]], $noreg, [[VAR_B]]47# CHECK: DBG_VALUE [[REG_A]], $noreg, [[VAR_A]]48# CHECK: DBG_VALUE [[REG_I]], $noreg, [[VAR_I]]49 50# CHECK: bb.4.for.cond.cleanup51# CHECK: DBG_VALUE [[REG_C]], $noreg, [[VAR_C]]52# CHECK: DBG_VALUE [[REG_B]], $noreg, [[VAR_B]]53# CHECK: DBG_VALUE [[REG_A]], $noreg, [[VAR_A]]54 55# CHECK: bb.5.if.end56# CHECK: DBG_VALUE [[REG_B]], $noreg, [[VAR_B]]57# CHECK: DBG_VALUE [[REG_A]], $noreg, [[VAR_A]]58--- |59 ; ModuleID = '/data/kwalker/work/OpenSource-llvm/llvm/test/CodeGen/ARM/dbg-range-extension.ll'60 source_filename = "/data/kwalker/work/OpenSource-llvm/llvm/test/CodeGen/ARM/dbg-range-extension.ll"61 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"62 target triple = "arm---eabi"63 64 ; Function Attrs: minsize nounwind optsize65 define void @func(i32 %a) local_unnamed_addr #0 !dbg !8 {66 entry:67 tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !13, metadata !20), !dbg !2168 %call = tail call i32 @func2(i32 10, i32 11) #0, !dbg !2269 tail call void @llvm.dbg.value(metadata i32 %call, i64 0, metadata !14, metadata !20), !dbg !2370 %tobool = icmp eq i32 %a, 0, !dbg !2471 br i1 %tobool, label %if.end, label %if.then, !dbg !2572 73 if.then: ; preds = %entry74 %call1 = tail call i32 @func2(i32 12, i32 13) #0, !dbg !2675 tail call void @llvm.dbg.value(metadata i32 %call1, i64 0, metadata !15, metadata !20), !dbg !2776 tail call void @llvm.dbg.value(metadata i32 1, i64 0, metadata !18, metadata !20), !dbg !2877 br label %for.cond, !dbg !2978 79 for.cond: ; preds = %for.body, %if.then80 %i.0 = phi i32 [ 1, %if.then ], [ %inc, %for.body ]81 tail call void @llvm.dbg.value(metadata i32 %i.0, i64 0, metadata !18, metadata !20), !dbg !2882 %cmp = icmp slt i32 %i.0, %a, !dbg !3083 br i1 %cmp, label %for.body, label %for.cond.cleanup, !dbg !3384 85 for.cond.cleanup: ; preds = %for.cond86 %call3 = tail call i32 @func2(i32 %call, i32 %call1) #0, !dbg !3487 br label %if.end, !dbg !3588 89 for.body: ; preds = %for.cond90 %0 = add i32 %call, %i.0, !dbg !3691 %call2 = tail call i32 @func2(i32 %i.0, i32 %0) #0, !dbg !3692 %inc = add nuw nsw i32 %i.0, 1, !dbg !3893 tail call void @llvm.dbg.value(metadata i32 %inc, i64 0, metadata !18, metadata !20), !dbg !2894 br label %for.cond, !dbg !40, !llvm.loop !4195 96 if.end: ; preds = %for.cond.cleanup, %entry97 %call4 = tail call i32 @func2(i32 %call, i32 %a) #0, !dbg !4398 ret void, !dbg !4499 }100 101 ; Function Attrs: minsize optsize102 declare i32 @func2(i32, i32) local_unnamed_addr #1103 104 ; Function Attrs: nounwind readnone105 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2106 107 ; Function Attrs: nounwind108 declare void @llvm.stackprotector(ptr, ptr) #3109 110 attributes #0 = { minsize nounwind optsize }111 attributes #1 = { minsize optsize }112 attributes #2 = { nounwind readnone }113 attributes #3 = { nounwind }114 115 !llvm.dbg.cu = !{!0}116 !llvm.module.flags = !{!3, !4, !5, !6}117 !llvm.ident = !{!7}118 119 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)120 !1 = !DIFile(filename: "loop.c", directory: "/tmp")121 !2 = !{}122 !3 = !{i32 2, !"Dwarf Version", i32 4}123 !4 = !{i32 2, !"Debug Info Version", i32 3}124 !5 = !{i32 1, !"wchar_size", i32 4}125 !6 = !{i32 1, !"min_enum_size", i32 4}126 !7 = !{!"clang version 4.0.0"}127 !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)128 !9 = !DISubroutineType(types: !10)129 !10 = !{null, !11}130 !11 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)131 !12 = !{!13, !14, !15, !18}132 !13 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !1, line: 2, type: !11)133 !14 = !DILocalVariable(name: "b", scope: !8, file: !1, line: 3, type: !11)134 !15 = !DILocalVariable(name: "c", scope: !16, file: !1, line: 5, type: !11)135 !16 = distinct !DILexicalBlock(scope: !17, file: !1, line: 4, column: 9)136 !17 = distinct !DILexicalBlock(scope: !8, file: !1, line: 4, column: 6)137 !18 = !DILocalVariable(name: "i", scope: !19, file: !1, line: 6, type: !11)138 !19 = distinct !DILexicalBlock(scope: !16, file: !1, line: 6, column: 3)139 !20 = !DIExpression()140 !21 = !DILocation(line: 2, column: 15, scope: !8)141 !22 = !DILocation(line: 3, column: 17, scope: !8)142 !23 = !DILocation(line: 3, column: 13, scope: !8)143 !24 = !DILocation(line: 4, column: 6, scope: !17)144 !25 = !DILocation(line: 4, column: 6, scope: !8)145 !26 = !DILocation(line: 5, column: 11, scope: !16)146 !27 = !DILocation(line: 5, column: 7, scope: !16)147 !28 = !DILocation(line: 6, column: 11, scope: !19)148 !29 = !DILocation(line: 6, column: 7, scope: !19)149 !30 = !DILocation(line: 6, column: 20, scope: !31)150 !31 = !DILexicalBlockFile(scope: !32, file: !1, discriminator: 1)151 !32 = distinct !DILexicalBlock(scope: !19, file: !1, line: 6, column: 3)152 !33 = !DILocation(line: 6, column: 3, scope: !31)153 !34 = !DILocation(line: 9, column: 3, scope: !16)154 !35 = !DILocation(line: 10, column: 2, scope: !16)155 !36 = !DILocation(line: 7, column: 4, scope: !37)156 !37 = distinct !DILexicalBlock(scope: !32, file: !1, line: 6, column: 30)157 !38 = !DILocation(line: 6, column: 26, scope: !39)158 !39 = !DILexicalBlockFile(scope: !32, file: !1, discriminator: 3)159 !40 = !DILocation(line: 6, column: 3, scope: !39)160 !41 = distinct !{!41, !42}161 !42 = !DILocation(line: 6, column: 3, scope: !16)162 !43 = !DILocation(line: 11, column: 2, scope: !8)163 !44 = !DILocation(line: 12, column: 1, scope: !8)164 165...166---167name: func168alignment: 4169exposesReturnsTwice: false170legalized: false171regBankSelected: false172selected: false173tracksRegLiveness: false174liveins: 175 - { reg: '$r0' }176calleeSavedRegisters: [ '$lr', '$d8', '$d9', '$d10', '$d11', '$d12', '$d13', 177 '$d14', '$d15', '$q4', '$q5', '$q6', '$q7', '$r4', 178 '$r5', '$r6', '$r7', '$r8', '$r9', '$r10', '$r11', 179 '$s16', '$s17', '$s18', '$s19', '$s20', '$s21', 180 '$s22', '$s23', '$s24', '$s25', '$s26', '$s27', 181 '$s28', '$s29', '$s30', '$s31', '$d8_d10', '$d9_d11', 182 '$d10_d12', '$d11_d13', '$d12_d14', '$d13_d15', 183 '$q4_q5', '$q5_q6', '$q6_q7', '$q4_q5_q6_q7', '$r4_r5', 184 '$r6_r7', '$r8_r9', '$r10_r11', '$d8_d9_d10', '$d9_d10_d11', 185 '$d10_d11_d12', '$d11_d12_d13', '$d12_d13_d14', 186 '$d13_d14_d15', '$d8_d10_d12', '$d9_d11_d13', '$d10_d12_d14', 187 '$d11_d13_d15', '$d8_d10_d12_d14', '$d9_d11_d13_d15', 188 '$d9_d10', '$d11_d12', '$d13_d14', '$d9_d10_d11_d12', 189 '$d11_d12_d13_d14' ]190frameInfo: 191 isFrameAddressTaken: false192 isReturnAddressTaken: false193 hasStackMap: false194 hasPatchPoint: false195 stackSize: 24196 offsetAdjustment: 0197 maxAlignment: 4198 adjustsStack: true199 hasCalls: true200 maxCallFrameSize: 0201 hasOpaqueSPAdjustment: false202 hasVAStart: false203 hasMustTailInVarArgFunc: false204stack: 205 - { id: 0, type: spill-slot, offset: -4, size: 4, alignment: 4, callee-saved-register: '$lr' }206 - { id: 1, type: spill-slot, offset: -8, size: 4, alignment: 4, callee-saved-register: '$r11' }207 - { id: 2, type: spill-slot, offset: -12, size: 4, alignment: 4, callee-saved-register: '$r7' }208 - { id: 3, type: spill-slot, offset: -16, size: 4, alignment: 4, callee-saved-register: '$r6' }209 - { id: 4, type: spill-slot, offset: -20, size: 4, alignment: 4, callee-saved-register: '$r5' }210 - { id: 5, type: spill-slot, offset: -24, size: 4, alignment: 4, callee-saved-register: '$r4' }211body: |212 bb.0.entry:213 liveins: $r0, $r4, $r5, $r6, $r7, $r11, $lr214 215 $sp = frame-setup STMDB_UPD $sp, 14, $noreg, killed $r4, killed $r5, killed $r6, killed $r7, killed $r11, killed $lr216 frame-setup CFI_INSTRUCTION def_cfa_offset 24217 frame-setup CFI_INSTRUCTION offset $lr, -4218 frame-setup CFI_INSTRUCTION offset $r11, -8219 frame-setup CFI_INSTRUCTION offset $r7, -12220 frame-setup CFI_INSTRUCTION offset $r6, -16221 frame-setup CFI_INSTRUCTION offset $r5, -20222 frame-setup CFI_INSTRUCTION offset $r4, -24223 DBG_VALUE $r0, $noreg, !13, !20, debug-location !21224 $r4 = MOVr killed $r0, 14, $noreg, $noreg225 DBG_VALUE $r4, $noreg, !13, !20, debug-location !21226 $r0 = MOVi 10, 14, $noreg, _, debug-location !22227 $r1 = MOVi 11, 14, $noreg, _, debug-location !22228 BL @func2, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit killed $r1, implicit-def $sp, implicit-def $r0, debug-location !22229 $r5 = MOVr killed $r0, 14, $noreg, _, debug-location !22230 DBG_VALUE $r5, $noreg, !14, !20, debug-location !23231 CMPri $r4, 0, 14, $noreg, implicit-def $cpsr, debug-location !25232 Bcc %bb.5.if.end, 0, killed $cpsr233 234 bb.1.if.then:235 liveins: $r4, $r5236 237 $r0 = MOVi 12, 14, $noreg, _, debug-location !26238 $r1 = MOVi 13, 14, $noreg, _, debug-location !26239 BL @func2, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit killed $r1, implicit-def $sp, implicit-def $r0, debug-location !26240 $r6 = MOVr killed $r0, 14, $noreg, _, debug-location !26241 DBG_VALUE $r6, $noreg, !15, !20, debug-location !27242 $r7 = MOVi 1, 14, $noreg, $noreg243 DBG_VALUE 1, 0, !18, !20, debug-location !28244 B %bb.3.for.cond245 246 bb.2.for.body:247 liveins: $r4, $r5, $r6, $r7248 249 $r1 = ADDrr $r5, $r7, 14, $noreg, _, debug-location !36250 $r0 = MOVr $r7, 14, $noreg, _, debug-location !36251 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 !36252 $r7 = ADDri killed $r7, 1, 14, $noreg, _, debug-location !38253 DBG_VALUE $r7, $noreg, !18, !20, debug-location !28254 255 bb.3.for.cond:256 liveins: $r4, $r5, $r6, $r7257 258 DBG_VALUE $r7, $noreg, !18, !20, debug-location !28259 CMPrr $r7, $r4, 14, $noreg, implicit-def $cpsr, debug-location !33260 Bcc %bb.2.for.body, 11, killed $cpsr, debug-location !33261 262 bb.4.for.cond.cleanup:263 liveins: $r4, $r5, $r6264 265 $r0 = MOVr $r5, 14, $noreg, _, debug-location !34266 $r1 = MOVr killed $r6, 14, $noreg, _, debug-location !34267 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 !34268 269 bb.5.if.end:270 liveins: $r4, $r5271 272 $r0 = MOVr killed $r5, 14, $noreg, _, debug-location !43273 $r1 = MOVr killed $r4, 14, $noreg, _, debug-location !43274 $sp = LDMIA_UPD $sp, 14, $noreg, def $r4, def $r5, def $r6, def $r7, def $r11, def $lr, debug-location !43275 TAILJMPd @func2, implicit $sp, implicit $sp, implicit killed $r0, implicit killed $r1, debug-location !43276 277...278