253 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: ![[ARG2:.*]] = !DILocalVariable(name: "arg2"9# CHECK: DBG_VALUE $s0_64, $noreg, ![[ARG2]], !DIExpression(), debug-location10# CHECK: $s1_64 = OR64 killed $s0_64, $zero_64, debug-location11# CHECK-NEXT: DBG_VALUE $s1_64, $noreg, ![[ARG2]], !DIExpression(), debug-location12# CHECK: DBG_VALUE $f24, $noreg, ![[ARG1]], !DIExpression(), debug-location13# CHECK: $f26 = FMOV_S killed $f24, debug-location14# CHECK-NEXT: DBG_VALUE $f26, $noreg, ![[ARG1]], !DIExpression(), debug-location15 16--- |17 ; ModuleID = 'live-debug-values-reg-copy.ll'18 source_filename = "live-debug-values-reg-copy.c"19 target datalayout = "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128"20 target triple = "mips64-octeon-linux"21 22 define float @foo(float %arg1, i32 signext %arg2) local_unnamed_addr !dbg !8 {23 entry:24 call void @llvm.dbg.value(metadata float %arg1, metadata !14, metadata !DIExpression()), !dbg !1925 call void @llvm.dbg.value(metadata i32 %arg2, metadata !15, metadata !DIExpression()), !dbg !1926 %conv = fpext float %arg1 to double, !dbg !1927 %cmp = fcmp ogt double %conv, 1.012310e+01, !dbg !1928 br i1 %cmp, label %if.then, label %if.else, !dbg !1929 30 if.then: ; preds = %entry31 %call = tail call float @externFunc(float %arg1), !dbg !1932 %call5 = tail call i32 @externFunc3(i32 signext %arg2), !dbg !1933 %conv6 = sitofp i32 %call5 to float, !dbg !1934 %add7 = fadd float %conv6, 0x3FF522D0E0000000, !dbg !1935 br label %if.end, !dbg !1936 37 if.else: ; preds = %entry38 %add8 = fadd float %arg1, 1.000000e+01, !dbg !1939 call void @llvm.dbg.value(metadata float %add8, metadata !14, metadata !DIExpression()), !dbg !1940 %call9 = tail call float @externFunc2(float %add8), !dbg !1941 %call10 = tail call i32 @externFunc4(i32 signext %arg2), !dbg !1942 %conv11 = sitofp i32 %call10 to float, !dbg !1943 %add12 = fadd float %call9, %conv11, !dbg !1944 %call14 = tail call float @externFunc(float %add8), !dbg !1945 br label %if.end46 47 if.end: ; preds = %if.else, %if.then48 %local.0 = phi float [ %add7, %if.then ], [ %add12, %if.else ]49 ret float %local.0, !dbg !1950 }51 52 declare float @externFunc(float) local_unnamed_addr53 54 declare i32 @externFunc3(i32 signext) local_unnamed_addr55 56 declare float @externFunc2(float) local_unnamed_addr57 58 declare i32 @externFunc4(i32 signext) local_unnamed_addr59 60 ; Function Attrs: nounwind readnone speculatable61 declare void @llvm.dbg.value(metadata, metadata, metadata) #062 63 ; Function Attrs: nounwind64 declare void @llvm.stackprotector(ptr, ptr) #165 66 attributes #0 = { nounwind readnone speculatable }67 attributes #1 = { nounwind }68 69 !llvm.dbg.cu = !{!0}70 !llvm.module.flags = !{!3, !4, !5, !6}71 !llvm.ident = !{!7}72 73 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 7.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)74 !1 = !DIFile(filename: "live-debug-values-reg-copy.c", directory: "/")75 !2 = !{}76 !3 = !{i32 2, !"Dwarf Version", i32 4}77 !4 = !{i32 2, !"Debug Info Version", i32 3}78 !5 = !{i32 1, !"wchar_size", i32 4}79 !6 = !{i32 7, !"PIC Level", i32 2}80 !7 = !{!"clang version 7.0.0 "}81 !8 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 6, type: !9, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !13)82 !9 = !DISubroutineType(types: !10)83 !10 = !{!11, !11, !12}84 !11 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)85 !12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)86 !13 = !{!14, !15}87 !14 = !DILocalVariable(name: "arg1", arg: 1, scope: !8, file: !1, line: 6, type: !11)88 !15 = !DILocalVariable(name: "arg2", arg: 2, scope: !8, file: !1, line: 6, type: !12)89 !19 = !DILocation(line: 6, column: 17, scope: !8)90 91...92---93name: foo94alignment: 895exposesReturnsTwice: false96legalized: false97regBankSelected: false98selected: false99tracksRegLiveness: false100registers:101liveins:102 - { reg: '$f12', virtual-reg: '' }103 - { reg: '$a1_64', virtual-reg: '' }104frameInfo:105 isFrameAddressTaken: false106 isReturnAddressTaken: false107 hasStackMap: false108 hasPatchPoint: false109 stackSize: 48110 offsetAdjustment: 0111 maxAlignment: 8112 adjustsStack: true113 hasCalls: true114 stackProtector: ''115 maxCallFrameSize: 0116 cvBytesOfCalleeSavedRegisters: 0117 hasOpaqueSPAdjustment: false118 hasVAStart: false119 hasMustTailInVarArgFunc: false120 localFrameSize: 0121 savePoint: []122 restorePoint: []123fixedStack: []124stack:125 - { id: 0, name: '', type: spill-slot, offset: -8, size: 8, alignment: 8,126 stack-id: default, callee-saved-register: '$d26_64', callee-saved-restored: true,127 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }128 - { id: 1, name: '', type: spill-slot, offset: -16, size: 8, alignment: 8,129 stack-id: default, callee-saved-register: '$d25_64', callee-saved-restored: true,130 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }131 - { id: 2, name: '', type: spill-slot, offset: -24, size: 8, alignment: 8,132 stack-id: default, callee-saved-register: '$d24_64', callee-saved-restored: true,133 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }134 - { id: 3, name: '', type: spill-slot, offset: -32, size: 8, alignment: 8,135 stack-id: default, callee-saved-register: '$ra_64', callee-saved-restored: true,136 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }137 - { id: 4, name: '', type: spill-slot, offset: -40, size: 8, alignment: 8,138 stack-id: default, callee-saved-register: '$s1_64', callee-saved-restored: true,139 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }140 - { id: 5, name: '', type: spill-slot, offset: -48, size: 8, alignment: 8,141 stack-id: default, callee-saved-register: '$s0_64', callee-saved-restored: true,142 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }143callSites: []144constants:145 - id: 0146 value: 'double 1.012310e+01'147 alignment: 8148 isTargetSpecific: false149 - id: 1150 value: 'float 1.000000e+01'151 alignment: 4152 isTargetSpecific: false153 - id: 2154 value: float 0x3FF522D0E0000000155 alignment: 4156 isTargetSpecific: false157body: |158 bb.0.entry:159 successors: %bb.1(0x40000000), %bb.2(0x40000000)160 liveins: $f12, $a1_64, $s1_64, $f26, $d26_64, $d25_64, $d24_64, $ra_64, $s1_64, $s0_64161 162 DBG_VALUE $f12, $noreg, !14, !DIExpression(), debug-location !19163 DBG_VALUE $a1_64, $noreg, !15, !DIExpression(), debug-location !19164 $sp_64 = DADDiu $sp_64, -48165 CFI_INSTRUCTION def_cfa_offset 48166 SDC164 killed $d26_64, $sp_64, 40 :: (store (s64) into %stack.0)167 SDC164 killed $d25_64, $sp_64, 32 :: (store (s64) into %stack.1)168 SDC164 killed $d24_64, $sp_64, 24 :: (store (s64) into %stack.2)169 SD killed $ra_64, $sp_64, 16 :: (store (s64) into %stack.3)170 SD killed $s1_64, $sp_64, 8 :: (store (s64) into %stack.4)171 SD killed $s0_64, $sp_64, 0 :: (store (s64) into %stack.5)172 CFI_INSTRUCTION offset $d27_64, -8173 CFI_INSTRUCTION offset $d26_64, -4174 CFI_INSTRUCTION offset $d26_64, -16175 CFI_INSTRUCTION offset $d25_64, -12176 CFI_INSTRUCTION offset $d25_64, -24177 CFI_INSTRUCTION offset $d24_64, -20178 CFI_INSTRUCTION offset $ra_64, -32179 CFI_INSTRUCTION offset $s1_64, -40180 CFI_INSTRUCTION offset $s0_64, -48181 renamable $s0_64 = COPY $a1_64182 DBG_VALUE $s0, $noreg, !15, !DIExpression(), debug-location !19183 DBG_VALUE $s0_64, $noreg, !15, !DIExpression(), debug-location !19184 DBG_VALUE $f12, $noreg, !14, !DIExpression(), debug-location !19185 renamable $d0_64 = CVT_D64_S renamable $f12, debug-location !19186 renamable $at_64 = LUi64 target-flags(mips-highest) %const.0187 renamable $at_64 = DADDiu killed renamable $at_64, target-flags(mips-higher) %const.0188 renamable $at_64 = DSLL killed renamable $at_64, 16189 renamable $at_64 = DADDiu killed renamable $at_64, target-flags(mips-abs-hi) %const.0190 renamable $at_64 = DSLL killed renamable $at_64, 16191 renamable $d1_64 = LDC164 killed renamable $at_64, target-flags(mips-abs-lo) %const.0 :: (load (s64) from constant-pool)192 FCMP_D64 killed renamable $d0_64, killed renamable $d1_64, 7, implicit-def $fcc0, debug-location !19193 BC1T killed $fcc0, %bb.2, implicit-def dead $at, debug-location !19194 J %bb.1, implicit-def dead $at, debug-location !19195 196 bb.1.if.then:197 successors: %bb.3(0x80000000)198 liveins: $f12, $s0_64199 200 JAL @externFunc, csr_n64, implicit-def dead $ra, implicit $f12, implicit-def $sp, implicit-def dead $f0, debug-location !19201 renamable $a0_64 = SLL64_32 renamable $s0, implicit $s0_64, debug-location !19202 JAL @externFunc3, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit-def $sp, implicit-def $v0, debug-location !19203 renamable $f0 = PseudoCVT_S_W killed renamable $v0, debug-location !19204 ; This instruction is inserted additionally in order to test moving from one register to another205 $s1_64 = OR64 killed $s0_64, $zero_64, debug-location !19206 renamable $at_64 = LUi64 target-flags(mips-highest) %const.2207 renamable $at_64 = DADDiu killed renamable $at_64, target-flags(mips-higher) %const.2208 renamable $at_64 = DSLL killed renamable $at_64, 16209 renamable $at_64 = DADDiu killed renamable $at_64, target-flags(mips-abs-hi) %const.2210 renamable $at_64 = DSLL killed renamable $at_64, 16211 renamable $f1 = LWC1 killed renamable $at_64, target-flags(mips-abs-lo) %const.2 :: (load (s32) from constant-pool)212 renamable $f0 = FADD_S killed renamable $f0, killed renamable $f1, debug-location !19213 J %bb.3, implicit-def dead $at, debug-location !19214 215 bb.2.if.else:216 successors: %bb.3(0x80000000)217 liveins: $f12, $s0_64218 219 renamable $at_64 = LUi64 target-flags(mips-highest) %const.1220 renamable $at_64 = DADDiu killed renamable $at_64, target-flags(mips-higher) %const.1221 renamable $at_64 = DSLL killed renamable $at_64, 16222 renamable $at_64 = DADDiu killed renamable $at_64, target-flags(mips-abs-hi) %const.1223 renamable $at_64 = DSLL killed renamable $at_64, 16224 renamable $f0 = LWC1 killed renamable $at_64, target-flags(mips-abs-lo) %const.1 :: (load (s32) from constant-pool)225 renamable $f24 = FADD_S killed renamable $f12, killed renamable $f0, debug-location !19226 DBG_VALUE $f24, $noreg, !14, !DIExpression(), debug-location !19227 $f12 = COPY renamable $f24, debug-location !19228 JAL @externFunc2, csr_n64, implicit-def dead $ra, implicit $f12, implicit-def $sp, implicit-def $f0, debug-location !19229 renamable $f25 = COPY $f0, debug-location !19230 renamable $a0_64 = SLL64_32 renamable $s0, implicit killed $s0_64, debug-location !19231 JAL @externFunc4, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit-def $sp, implicit-def $v0, debug-location !19232 renamable $s0 = COPY $v0, debug-location !19233 $f12 = COPY renamable $f24, debug-location !19234 JAL @externFunc, csr_n64, implicit-def dead $ra, implicit $f12, implicit-def $sp, implicit-def dead $f0, debug-location !19235 renamable $f0 = PseudoCVT_S_W killed renamable $s0, debug-location !19236 renamable $f0 = FADD_S killed renamable $f25, killed renamable $f0, debug-location !19237 ; This instruction is inserted additionally in order to test moving variable's value from one float register to another.238 $f26 = FMOV_S killed $f24, debug-location !19239 240 bb.3.if.end:241 liveins: $f0242 243 $s0_64 = LD $sp_64, 0, debug-location !19 :: (load (s64) from %stack.5)244 $s1_64 = LD $sp_64, 8, debug-location !19 :: (load (s64) from %stack.4)245 $ra_64 = LD $sp_64, 16, debug-location !19 :: (load (s64) from %stack.3)246 $d24_64 = LDC164 $sp_64, 24, debug-location !19 :: (load (s64) from %stack.2)247 $d25_64 = LDC164 $sp_64, 32, debug-location !19 :: (load (s64) from %stack.1)248 $d26_64 = LDC164 $sp_64, 40, debug-location !19 :: (load (s64) from %stack.0)249 $sp_64 = DADDiu $sp_64, 48250 RetRA implicit $f0, debug-location !19251 252...253