148 lines · plain
1# RUN: llc -run-pass=livedebugvalues %s -o - | FileCheck %s2#3# This test tests tracking variables value transferring from one register to another.4# This example is altered additionally in order to test transferring from one float register5# to another. The altered instructions are labeled below.6#7# CHECK: ![[ARG1:.*]] = !DILocalVariable(name: "arg1"8# CHECK: DBG_VALUE $r4, $noreg, ![[ARG1]], !DIExpression(), debug-location9# CHECK: $r5 = MOVr killed $r4, 14 /* CC::al */, $noreg, $noreg, debug-location10# CHECK-NEXT: DBG_VALUE $r5, $noreg, ![[ARG1]], !DIExpression(), debug-location11--- |12 ; ModuleID = 'live-debug-values-reg-copy.ll'13 source_filename = "live-debug-values-reg-copy.c"14 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"15 target triple = "armv4t--"16 17 define dso_local arm_aapcscc i32 @foo(i32 %arg1) local_unnamed_addr !dbg !8 {18 entry:19 call void @llvm.dbg.value(metadata i32 %arg1, metadata !13, metadata !DIExpression()), !dbg !1620 %cmp = icmp sgt i32 %arg1, 10, !dbg !1621 br i1 %cmp, label %if.end, label %if.else, !dbg !1622 23 if.else: ; preds = %entry24 %add5 = add nsw i32 %arg1, 10, !dbg !1625 call void @llvm.dbg.value(metadata i32 %add5, metadata !13, metadata !DIExpression()), !dbg !1626 %call6 = tail call arm_aapcscc i32 @externFunc2(i32 %add5), !dbg !1627 %call8 = tail call arm_aapcscc i32 @externFunc(i32 %add5), !dbg !1628 ret i32 %call6, !dbg !1629 30 if.end: ; preds = %entry31 %call = tail call arm_aapcscc i32 @externFunc(i32 %arg1), !dbg !1632 ret i32 1, !dbg !1633 }34 35 declare dso_local arm_aapcscc i32 @externFunc(i32) local_unnamed_addr36 37 declare dso_local arm_aapcscc i32 @externFunc2(i32) local_unnamed_addr38 39 ; Function Attrs: nounwind readnone speculatable40 declare void @llvm.dbg.value(metadata, metadata, metadata) #041 42 ; Function Attrs: nounwind43 declare void @llvm.stackprotector(ptr, ptr) #144 45 attributes #0 = { nounwind readnone speculatable }46 attributes #1 = { nounwind }47 48 !llvm.dbg.cu = !{!0}49 !llvm.module.flags = !{!3, !4, !5, !6}50 !llvm.ident = !{!7}51 52 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 7.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)53 !1 = !DIFile(filename: "live-debug-values-reg-copy.c", directory: "/")54 !2 = !{}55 !3 = !{i32 2, !"Dwarf Version", i32 4}56 !4 = !{i32 2, !"Debug Info Version", i32 3}57 !5 = !{i32 1, !"wchar_size", i32 4}58 !6 = !{i32 1, !"min_enum_size", i32 4}59 !7 = !{!"clang version 7.0.0"}60 !8 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, type: !9, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12)61 !9 = !DISubroutineType(types: !10)62 !10 = !{!11, !11}63 !11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)64 !12 = !{!13}65 !13 = !DILocalVariable(name: "arg1", arg: 1, scope: !8, file: !1, line: 4, type: !11)66 !16 = !DILocation(line: 4, column: 13, scope: !8)67 68...69---70name: foo71alignment: 472exposesReturnsTwice: false73legalized: false74regBankSelected: false75selected: false76tracksRegLiveness: false77registers: 78liveins: 79 - { reg: '$r0', virtual-reg: '' }80frameInfo: 81 isFrameAddressTaken: false82 isReturnAddressTaken: false83 hasStackMap: false84 hasPatchPoint: false85 stackSize: 1686 offsetAdjustment: 087 maxAlignment: 488 adjustsStack: true89 hasCalls: true90 stackProtector: ''91 maxCallFrameSize: 092 hasOpaqueSPAdjustment: false93 hasVAStart: false94 hasMustTailInVarArgFunc: false95 savePoint: []96 restorePoint: []97fixedStack: 98stack: 99 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4, 100 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: true,101 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }102 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4, 103 stack-id: default, callee-saved-register: '$r11', callee-saved-restored: true,104 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }105 - { id: 2, name: '', type: spill-slot, offset: -12, size: 4, alignment: 4, 106 stack-id: default, callee-saved-register: '$r5', callee-saved-restored: true,107 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }108 - { id: 3, name: '', type: spill-slot, offset: -16, size: 4, alignment: 4, 109 stack-id: default, callee-saved-register: '$r4', callee-saved-restored: true,110 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }111constants: 112body: |113 bb.0.entry:114 successors: %bb.1(0x40000000), %bb.2(0x40000000)115 116 $sp = frame-setup STMDB_UPD $sp, 14, $noreg, killed $r4, killed $r5, killed $r11, killed $lr117 frame-setup CFI_INSTRUCTION def_cfa_offset 16118 frame-setup CFI_INSTRUCTION offset $lr, -4119 frame-setup CFI_INSTRUCTION offset $r11, -8120 frame-setup CFI_INSTRUCTION offset $r5, -12121 frame-setup CFI_INSTRUCTION offset $r4, -16122 DBG_VALUE $r0, $noreg, !13, !DIExpression(), debug-location !16123 DBG_VALUE $r0, $noreg, !13, !DIExpression(), debug-location !16124 CMPri renamable $r0, 10, 14, $noreg, implicit-def $cpsr, debug-location !16125 Bcc %bb.2, 13, killed $cpsr, debug-location !16126 127 bb.1.if.end:128 BL @externFunc, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit-def $sp, implicit-def dead $r0, debug-location !16129 $r0 = MOVi 1, 14, $noreg, $noreg, debug-location !16130 $sp = LDMIA_UPD $sp, 14, $noreg, def $r4, def $r5, def $r11, def $lr, debug-location !16131 BX_RET 14, $noreg, implicit killed $r0, debug-location !16132 133 bb.2.if.else:134 renamable $r4 = ADDri killed renamable $r0, 10, 14, $noreg, $noreg, debug-location !16135 DBG_VALUE $r4, $noreg, !13, !DIExpression(), debug-location !16136 $r0 = MOVr $r4, 14, $noreg, $noreg, debug-location !16137 BL @externFunc2, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit-def $sp, implicit-def $r0, debug-location !16138 $r5 = MOVr killed $r0, 14, $noreg, $noreg, debug-location !16139 $r0 = MOVr $r4, 14, $noreg, $noreg, debug-location !16140 BL @externFunc, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit-def $sp, implicit-def dead $r0, debug-location !16141 $r0 = MOVr killed $r5, 14, $noreg, $noreg, debug-location !16142 ; Instruction below is added in order to test moving variable's value from one register to another.143 $r5 = MOVr killed $r4, 14, $noreg, $noreg, debug-location !16144 $sp = LDMIA_UPD $sp, 14, $noreg, def $r4, def $r5, def $r11, def $lr, debug-location !16145 BX_RET 14, $noreg, implicit killed $r0, debug-location !16146 147...148