1 # RUN: llc -run-pass=livedebugvalues %s -o - | FileCheck %s
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 register
5 # to another. The altered instructions are labeled below.
7 # CHECK: ![[ARG1:.*]] = !DILocalVariable(name: "arg1"
8 # CHECK: ![[ARG2:.*]] = !DILocalVariable(name: "arg2"
9 # CHECK: DBG_VALUE $s0_64, $noreg, ![[ARG2]], !DIExpression(), debug-location
10 # CHECK: $s1_64 = OR64 killed $s0_64, $zero_64, debug-location
11 # CHECK-NEXT: DBG_VALUE $s1_64, $noreg, ![[ARG2]], !DIExpression(), debug-location
12 # CHECK: DBG_VALUE $f24, $noreg, ![[ARG1]], !DIExpression(), debug-location
13 # CHECK: $f26 = FMOV_S killed $f24, debug-location
14 # CHECK-NEXT: DBG_VALUE $f26, $noreg, ![[ARG1]], !DIExpression(), debug-location
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"
22 define float @foo(float %arg1, i32 signext %arg2) local_unnamed_addr !dbg !8 {
24 call void @llvm.dbg.value(metadata float %arg1, metadata !14, metadata !DIExpression()), !dbg !19
25 call void @llvm.dbg.value(metadata i32 %arg2, metadata !15, metadata !DIExpression()), !dbg !19
26 %conv = fpext float %arg1 to double, !dbg !19
27 %cmp = fcmp ogt double %conv, 1.012310e+01, !dbg !19
28 br i1 %cmp, label %if.then, label %if.else, !dbg !19
30 if.then: ; preds = %entry
31 %call = tail call float @externFunc(float %arg1), !dbg !19
32 %call5 = tail call i32 @externFunc3(i32 signext %arg2), !dbg !19
33 %conv6 = sitofp i32 %call5 to float, !dbg !19
34 %add7 = fadd float %conv6, 0x3FF522D0E0000000, !dbg !19
35 br label %if.end, !dbg !19
37 if.else: ; preds = %entry
38 %add8 = fadd float %arg1, 1.000000e+01, !dbg !19
39 call void @llvm.dbg.value(metadata float %add8, metadata !14, metadata !DIExpression()), !dbg !19
40 %call9 = tail call float @externFunc2(float %add8), !dbg !19
41 %call10 = tail call i32 @externFunc4(i32 signext %arg2), !dbg !19
42 %conv11 = sitofp i32 %call10 to float, !dbg !19
43 %add12 = fadd float %call9, %conv11, !dbg !19
44 %call14 = tail call float @externFunc(float %add8), !dbg !19
47 if.end: ; preds = %if.else, %if.then
48 %local.0 = phi float [ %add7, %if.then ], [ %add12, %if.else ]
49 ret float %local.0, !dbg !19
52 declare float @externFunc(float) local_unnamed_addr
54 declare i32 @externFunc3(i32 signext) local_unnamed_addr
56 declare float @externFunc2(float) local_unnamed_addr
58 declare i32 @externFunc4(i32 signext) local_unnamed_addr
60 ; Function Attrs: nounwind readnone speculatable
61 declare void @llvm.dbg.value(metadata, metadata, metadata) #0
63 ; Function Attrs: nounwind
64 declare void @llvm.stackprotector(i8*, i8**) #1
66 attributes #0 = { nounwind readnone speculatable }
67 attributes #1 = { nounwind }
70 !llvm.module.flags = !{!3, !4, !5, !6}
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: "/")
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)
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)
95 exposesReturnsTwice: false
97 regBankSelected: false
99 tracksRegLiveness: false
102 - { reg: '$f12', virtual-reg: '' }
103 - { reg: '$a1_64', virtual-reg: '' }
105 isFrameAddressTaken: false
106 isReturnAddressTaken: false
116 hasOpaqueSPAdjustment: false
118 hasMustTailInVarArgFunc: false
123 - { id: 0, name: '', type: spill-slot, offset: -8, size: 8, alignment: 8,
124 stack-id: default, callee-saved-register: '$d25_64', callee-saved-restored: true,
125 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
126 - { id: 1, name: '', type: spill-slot, offset: -16, size: 8, alignment: 8,
127 stack-id: default, callee-saved-register: '$d24_64', callee-saved-restored: true,
128 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
129 - { id: 2, name: '', type: spill-slot, offset: -24, size: 8, alignment: 8,
130 stack-id: default, callee-saved-register: '$ra_64', callee-saved-restored: true,
131 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
132 - { id: 3, name: '', type: spill-slot, offset: -32, size: 8, alignment: 8,
133 stack-id: default, callee-saved-register: '$s0_64', callee-saved-restored: true,
134 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
137 value: 'double 1.012310e+01'
139 isTargetSpecific: false
141 value: 'float 1.000000e+01'
143 isTargetSpecific: false
145 value: float 0x3FF522D0E0000000
147 isTargetSpecific: false
150 successors: %bb.1(0x40000000), %bb.2(0x40000000)
152 $sp_64 = DADDiu $sp_64, -32
153 CFI_INSTRUCTION def_cfa_offset 32
154 SDC164 killed $d25_64, $sp_64, 24 :: (store 8 into %stack.0)
155 SDC164 killed $d24_64, $sp_64, 16 :: (store 8 into %stack.1)
156 SD killed $ra_64, $sp_64, 8 :: (store 8 into %stack.2)
157 SD killed $s0_64, $sp_64, 0 :: (store 8 into %stack.3)
158 CFI_INSTRUCTION offset $d26_64, -8
159 CFI_INSTRUCTION offset $d25_64, -4
160 CFI_INSTRUCTION offset $d25_64, -16
161 CFI_INSTRUCTION offset $d24_64, -12
162 CFI_INSTRUCTION offset $ra_64, -24
163 CFI_INSTRUCTION offset $s0_64, -32
164 DBG_VALUE $f12, $noreg, !14, !DIExpression(), debug-location !19
165 DBG_VALUE $a1_64, $noreg, !15, !DIExpression(), debug-location !19
166 DBG_VALUE $s0, $noreg, !15, !DIExpression(), debug-location !19
167 DBG_VALUE $s0_64, $noreg, !15, !DIExpression(), debug-location !19
168 DBG_VALUE $f12, $noreg, !14, !DIExpression(), debug-location !19
169 renamable $d0_64 = CVT_D64_S renamable $f12, debug-location !19
170 renamable $at_64 = LUi64 target-flags(mips-highest) %const.0
171 renamable $at_64 = DADDiu killed renamable $at_64, target-flags(mips-higher) %const.0
172 renamable $at_64 = DSLL killed renamable $at_64, 16
173 renamable $at_64 = DADDiu killed renamable $at_64, target-flags(mips-abs-hi) %const.0
174 renamable $at_64 = DSLL killed renamable $at_64, 16
175 renamable $d1_64 = LDC164 killed renamable $at_64, target-flags(mips-abs-lo) %const.0, debug-location !19 :: (load 8 from constant-pool)
176 FCMP_D64 killed renamable $d0_64, killed renamable $d1_64, 7, implicit-def $fcc0, debug-location !19
177 BC1T killed $fcc0, %bb.2, implicit-def $at, debug-location !19 {
178 $s0_64 = OR64 $a1_64, $zero_64
182 successors: %bb.3(0x80000000)
184 JAL @externFunc, csr_n64, implicit-def dead $ra, implicit $f12, implicit-def $sp, implicit-def dead $f0, debug-location !19 {
185 NOP debug-location !19
187 JAL @externFunc3, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit-def $sp, implicit-def $v0, debug-location !19 {
188 renamable $a0_64 = SLL64_32 renamable $s0, implicit $s0_64, debug-location !19
190 $f0 = MTC1 killed $v0, debug-location !19
191 $f0 = CVT_S_W killed $f0, debug-location !19
192 ; This instruction is inserted additionally in order to test moving from one register to another
193 $s1_64 = OR64 killed $s0_64, $zero_64, debug-location !19
194 renamable $at_64 = LUi64 target-flags(mips-highest) %const.2
195 renamable $at_64 = DADDiu killed renamable $at_64, target-flags(mips-higher) %const.2
196 renamable $at_64 = DSLL killed renamable $at_64, 16
197 renamable $at_64 = DADDiu killed renamable $at_64, target-flags(mips-abs-hi) %const.2
198 renamable $at_64 = DSLL killed renamable $at_64, 16
199 renamable $f1 = LWC1 killed renamable $at_64, target-flags(mips-abs-lo) %const.2, debug-location !19 :: (load 4 from constant-pool)
200 J %bb.3, implicit-def dead $at, debug-location !19 {
201 renamable $f0 = FADD_S killed renamable $f0, killed renamable $f1, debug-location !19
205 successors: %bb.3(0x80000000)
207 renamable $at_64 = LUi64 target-flags(mips-highest) %const.1
208 renamable $at_64 = DADDiu killed renamable $at_64, target-flags(mips-higher) %const.1
209 renamable $at_64 = DSLL killed renamable $at_64, 16
210 renamable $at_64 = DADDiu killed renamable $at_64, target-flags(mips-abs-hi) %const.1
211 renamable $at_64 = DSLL killed renamable $at_64, 16
212 renamable $f0 = LWC1 killed renamable $at_64, target-flags(mips-abs-lo) %const.1, debug-location !19 :: (load 4 from constant-pool)
213 renamable $f24 = FADD_S killed renamable $f12, killed renamable $f0, debug-location !19
214 DBG_VALUE $f24, $noreg, !14, !DIExpression(), debug-location !19
215 JAL @externFunc2, csr_n64, implicit-def dead $ra, implicit $f12, implicit-def $sp, implicit-def $f0, debug-location !19 {
216 $f12 = FMOV_S $f24, debug-location !19
218 $f25 = FMOV_S $f0, debug-location !19
219 JAL @externFunc4, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit-def $sp, implicit-def $v0, debug-location !19 {
220 renamable $a0_64 = SLL64_32 renamable $s0, implicit killed $s0_64, debug-location !19
222 $s0 = OR $v0, $zero, debug-location !19
223 JAL @externFunc, csr_n64, implicit-def dead $ra, implicit $f12, implicit-def $sp, implicit-def dead $f0, debug-location !19 {
224 $f12 = FMOV_S $f24, debug-location !19
226 $f0 = MTC1 killed $s0, debug-location !19
227 $f0 = CVT_S_W killed $f0, debug-location !19
228 renamable $f0 = FADD_S renamable $f25, killed renamable $f0, debug-location !19
229 ; This instruction is inserted additionally in order to test moving variable's value from one float register to another.
230 $f26 = FMOV_S killed $f24, debug-location !19
233 $s0_64 = LD $sp_64, 0, debug-location !19 :: (load 8 from %stack.3)
234 $ra_64 = LD $sp_64, 8, debug-location !19 :: (load 8 from %stack.2)
235 $d24_64 = LDC164 $sp_64, 16, debug-location !19 :: (load 8 from %stack.1)
236 $d25_64 = LDC164 $sp_64, 24, debug-location !19 :: (load 8 from %stack.0)
237 PseudoReturn64 undef $ra_64, implicit $f0, debug-location !19 {
238 $sp_64 = DADDiu $sp_64, 32