1 # RUN: llc -start-after=machine-scheduler %s -o - | FileCheck %s
4 # See PR41992, the third and final dbg.value disappears after
18 # CHECK-LABEL: f: # @f
19 # CHECK: movl %ecx, [[OFF_X:[0-9]+]](%rsp)
20 # CHECK: #DEBUG_VALUE: f:x <- [DW_OP_plus_uconst [[OFF_X]], DW_OP_deref] $rsp
21 # CHECK: leaq [[OFF_X]](%rsp), %rsi
23 # CHECK: #DEBUG_VALUE: f:x <- 1
24 # CHECK: movl $1, global(%rip)
25 # CHECK: #DEBUG_VALUE: f:x <- [DW_OP_plus_uconst [[OFF_X]], DW_OP_deref] $rsp
26 # CHECK: movl $2, [[OFF_X]](%rsp)
32 ; ModuleID = '<stdin>'
33 source_filename = "dse.c"
34 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
35 target triple = "x86_64-pc-windows-msvc19.0.24215"
37 @global = external global i32, align 4
39 ; Function Attrs: nounwind readnone speculatable
40 declare void @llvm.dbg.value(metadata, metadata, metadata) #0
42 declare void @escape(i32*)
44 ; Function Attrs: nounwind uwtable
45 define void @f(i32 %x) #1 !dbg !8 {
47 %x.addr = alloca i32, align 4
48 store i32 %x, i32* %x.addr, align 4
49 call void @llvm.dbg.value(metadata i32* %x.addr, metadata !13, metadata !DIExpression(DW_OP_deref)), !dbg !14
50 call void @escape(i32* %x.addr), !dbg !15
51 call void @llvm.dbg.value(metadata i32 1, metadata !13, metadata !DIExpression()), !dbg !16
52 store i32 1, i32* @global, align 4, !dbg !17
53 call void @llvm.dbg.value(metadata i32* %x.addr, metadata !13, metadata !DIExpression(DW_OP_deref)), !dbg !18
54 store i32 2, i32* %x.addr, align 4, !dbg !18
55 call void @escape(i32* %x.addr), !dbg !19
59 ; Function Attrs: nounwind
60 declare void @llvm.stackprotector(i8*, i8**) #2
62 attributes #0 = { nounwind readnone speculatable }
63 attributes #1 = { nounwind uwtable }
64 attributes #2 = { nounwind }
67 !llvm.module.flags = !{!3, !4, !5, !6}
70 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
71 !1 = !DIFile(filename: "dse.c", directory: "C:\5Csrc\5Cllvm-project\5Cbuild")
73 !3 = !{i32 2, !"Dwarf Version", i32 4}
74 !4 = !{i32 2, !"Debug Info Version", i32 3}
75 !5 = !{i32 1, !"wchar_size", i32 2}
76 !6 = !{i32 7, !"PIC Level", i32 2}
77 !7 = !{!"clang version 6.0.0 "}
78 !8 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 3, type: !9, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12)
79 !9 = !DISubroutineType(types: !10)
81 !11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
83 !13 = !DILocalVariable(name: "x", arg: 1, scope: !8, file: !1, line: 3, type: !11)
84 !14 = !DILocation(line: 3, column: 12, scope: !8)
85 !15 = !DILocation(line: 4, column: 3, scope: !8)
86 !16 = !DILocation(line: 5, column: 5, scope: !8)
87 !17 = !DILocation(line: 6, column: 10, scope: !8)
88 !18 = !DILocation(line: 7, column: 5, scope: !8)
89 !19 = !DILocation(line: 8, column: 3, scope: !8)
90 !20 = !DILocation(line: 9, column: 1, scope: !8)
96 exposesReturnsTwice: false
98 regBankSelected: false
100 tracksRegLiveness: true
102 - { id: 0, class: gr32, preferred-register: '' }
103 - { id: 1, class: gr64, preferred-register: '' }
105 - { reg: '$ecx', virtual-reg: '%0' }
107 isFrameAddressTaken: false
108 isReturnAddressTaken: false
117 maxCallFrameSize: 4294967295
118 hasOpaqueSPAdjustment: false
120 hasMustTailInVarArgFunc: false
125 - { id: 0, name: x.addr, type: default, offset: 0, size: 4, alignment: 4,
126 stack-id: default, callee-saved-register: '', debug-info-variable: '',
127 debug-info-expression: '', debug-info-location: '' }
134 MOV32mr %stack.0.x.addr, 1, _, 0, _, %0 :: (store 4 into %ir.x.addr)
135 DBG_VALUE %stack.0.x.addr, $noreg, !13, !DIExpression(DW_OP_deref), debug-location !14
136 ADJCALLSTACKDOWN64 32, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !15
137 %1 = LEA64r %stack.0.x.addr, 1, _, 0, _
138 $rcx = COPY %1, debug-location !15
139 CALL64pcrel32 @escape, csr_win64, implicit $rsp, implicit $ssp, implicit $rcx, implicit-def $rsp, implicit-def $ssp, debug-location !15
140 ADJCALLSTACKUP64 32, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !15
141 DBG_VALUE 1, _, !13, !DIExpression(), debug-location !16
142 MOV32mi $rip, 1, _, @global, _, 1, debug-location !17 :: (store 4 into @global)
143 DBG_VALUE %stack.0.x.addr, $noreg, !13, !DIExpression(DW_OP_deref), debug-location !18
144 MOV32mi %stack.0.x.addr, 1, _, 0, _, 2, debug-location !18 :: (store 4 into %ir.x.addr)
145 ADJCALLSTACKDOWN64 32, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !19
146 $rcx = COPY %1, debug-location !19
147 CALL64pcrel32 @escape, csr_win64, implicit $rsp, implicit $ssp, implicit $rcx, implicit-def $rsp, implicit-def $ssp, debug-location !19
148 ADJCALLSTACKUP64 32, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !19
149 RET 0, debug-location !20