1 # RUN: llc -filetype=obj -O0 %s -o - | llvm-readobj -codeview | FileCheck %s
3 # (DW_OP_plus_uconst 12)
5 # CHECK-NEXT: Kind: S_LOCAL (0x113E)
6 # CHECK-NEXT: Type: string* (0x
7 # CHECK-NEXT: Flags [ (0x0)
9 # CHECK-NEXT: VarName: Str
11 # CHECK-NEXT: DefRangeRegisterRelSym {
12 # CHECK-NEXT: Kind: S_DEFRANGE_REGISTER_REL (0x1145)
13 # CHECK-NEXT: BaseRegister:
14 # CHECK-NEXT: HasSpilledUDTMember: No
15 # CHECK-NEXT: OffsetInParent: 0
16 # CHECK-NEXT: BasePointerOffset: 12
17 # CHECK-NEXT: LocalVariableAddrRange {
18 # CHECK-NEXT: OffsetStart:
19 # CHECK-NEXT: ISectStart:
23 # (DW_OP_plus_uconst, 8, DW_OP_deref)
25 # CHECK-NEXT: Kind: S_LOCAL (0x113E)
26 # CHECK-NEXT: Type: string& (0x
27 # CHECK-NEXT: Flags [ (0x0)
29 # CHECK-NEXT: VarName: Result
31 # CHECK-NEXT: DefRangeRegisterRelSym {
32 # CHECK-NEXT: Kind: S_DEFRANGE_REGISTER_REL (0x1145)
33 # CHECK-NEXT: BaseRegister:
34 # CHECK-NEXT: HasSpilledUDTMember: No
35 # CHECK-NEXT: OffsetInParent: 0
36 # CHECK-NEXT: BasePointerOffset: 8
37 # CHECK-NEXT: LocalVariableAddrRange {
38 # CHECK-NEXT: OffsetStart:
39 # CHECK-NEXT: ISectStart:
43 # (DW_OP_constu, 4, DW_OP_minus)
45 # CHECK-NEXT: Kind: S_LOCAL (0x113E)
46 # CHECK-NEXT: Type: long (0x12)
47 # CHECK-NEXT: Flags [ (0x0)
49 # CHECK-NEXT: VarName: Bytes
51 # CHECK-NEXT: DefRangeRegisterRelSym {
52 # CHECK-NEXT: Kind: S_DEFRANGE_REGISTER_REL (0x1145)
53 # CHECK-NEXT: BaseRegister:
54 # CHECK-NEXT: HasSpilledUDTMember: No
55 # CHECK-NEXT: OffsetInParent: 0
56 # CHECK-NEXT: BasePointerOffset: -4
57 # CHECK-NEXT: LocalVariableAddrRange {
58 # CHECK-NEXT: OffsetStart:
59 # CHECK-NEXT: ISectStart:
64 ; ModuleID = '<stdin>'
65 source_filename = "<stdin>"
66 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
67 target triple = "i386-pc-windows-msvc19.0.24215"
69 %struct.string = type { i32, i32, i8* }
71 define void @fun(%struct.string* noalias sret %agg.result, %struct.string* noalias %str) !dbg !12 {
73 call void @llvm.dbg.value(metadata %struct.string* %agg.result, metadata !23, metadata !24), !dbg !25
74 call void @llvm.dbg.value(metadata %struct.string* %str, metadata !26, metadata !28), !dbg !25
75 %call = call dereferenceable(12) %struct.string* @getString(), !dbg !29
76 %0 = bitcast %struct.string* %agg.result to i8*, !dbg !29
77 %1 = bitcast %struct.string* %call to i8*, !dbg !29
78 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* %1, i32 12, i32 4, i1 false), !dbg !29
82 define i32 @len(%struct.string* %s, i32 %acc) !dbg !31 {
84 %0 = bitcast %struct.string* %s to i32*
85 %bytes = load i32, i32* %0, !dbg !34
86 call void @llvm.dbg.declare(metadata i32 %bytes, metadata !35, metadata !28), !dbg !34
87 %1 = add i32 %bytes, %acc, !dbg !36
91 ; Function Attrs: nounwind readnone speculatable
92 declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
94 ; Function Attrs: nounwind readnone speculatable
95 declare void @llvm.dbg.value(metadata, metadata, metadata) #0
97 declare dereferenceable(12) %struct.string* @getString()
99 ; Function Attrs: argmemonly nounwind
100 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i32, i1) #1
102 ; Function Attrs: nounwind
103 declare void @llvm.stackprotector(i8*, i8**) #2
105 attributes #0 = { nounwind readnone speculatable }
106 attributes #1 = { argmemonly nounwind }
107 attributes #2 = { nounwind }
110 !llvm.linker.options = !{!3, !4}
111 !llvm.module.flags = !{!5, !6, !7, !8}
114 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 6.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
115 !1 = !DIFile(filename: "diexpr.ll", directory: "C:\5Csrc", checksumkind: CSK_MD5, checksum: "c547c362c610fa79e7abaddc76e1efe7")
117 !3 = !{!"/DEFAULTLIB:libcmt.lib"}
118 !4 = !{!"/DEFAULTLIB:oldnames.lib"}
119 !5 = !{i32 1, !"NumRegisterParameters", i32 0}
120 !6 = !{i32 2, !"CodeView", i32 1}
121 !7 = !{i32 2, !"Debug Info Version", i32 3}
122 !8 = !{i32 1, !"wchar_size", i32 2}
123 !9 = !{!"clang version 6.0.0 "}
124 !10 = !DIExpression(DW_OP_plus_uconst, 12)
125 !11 = !DIExpression(DW_OP_plus_uconst, 8, DW_OP_deref)
126 !12 = distinct !DISubprogram(name: "fun", linkageName: "fun", scope: !1, file: !1, line: 9, type: !13, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
127 !13 = !DISubroutineType(types: !14)
129 !15 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "string", file: !1, line: 1, size: 96, elements: !16, identifier: ".?AUstring@@")
130 !16 = !{!17, !19, !20}
131 !17 = !DIDerivedType(tag: DW_TAG_member, name: "length", scope: !15, file: !1, line: 2, baseType: !18, size: 32)
132 !18 = !DIBasicType(name: "long int", size: 32, encoding: DW_ATE_signed)
133 !19 = !DIDerivedType(tag: DW_TAG_member, name: "size", scope: !15, file: !1, line: 3, baseType: !18, size: 32, offset: 32)
134 !20 = !DIDerivedType(tag: DW_TAG_member, name: "data", scope: !15, file: !1, line: 4, baseType: !21, size: 32, offset: 64)
135 !21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !22, size: 32)
136 !22 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
137 !23 = !DILocalVariable(name: "Result", scope: !12, file: !1, line: 10, type: !15)
138 !24 = !DIExpression(DW_OP_deref)
139 !25 = !DILocation(line: 10, scope: !12)
140 !26 = !DILocalVariable(name: "Str", scope: !12, file: !1, line: 10, type: !27)
141 !27 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !15, size: 32)
142 !28 = !DIExpression(DW_OP_constu, 4, DW_OP_minus)
143 !29 = !DILocation(line: 11, scope: !12)
144 !30 = !DILocation(line: 12, scope: !12)
145 !31 = distinct !DISubprogram(name: "len", linkageName: "len", scope: !1, file: !1, line: 14, type: !32, isLocal: false, isDefinition: true, scopeLine: 14, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
146 !32 = !DISubroutineType(types: !33)
148 !34 = !DILocation(line: 15, scope: !31)
149 !35 = !DILocalVariable(name: "Bytes", scope: !31, file: !1, line: 15, type: !18)
150 !36 = !DILocation(line: 16, scope: !31)
156 exposesReturnsTwice: false
158 regBankSelected: false
160 tracksRegLiveness: true
164 isFrameAddressTaken: false
165 isReturnAddressTaken: false
175 hasOpaqueSPAdjustment: false
177 hasMustTailInVarArgFunc: false
181 - { id: 0, type: spill-slot, offset: -8, size: 4, alignment: 4, stack-id: 0,
182 callee-saved-register: '$esi' }
183 - { id: 1, type: default, offset: 4, size: 4, alignment: 4, stack-id: 0,
184 isImmutable: true, isAliased: false, callee-saved-register: '' }
185 - { id: 2, type: default, offset: 0, size: 4, alignment: 4, stack-id: 0,
186 isImmutable: true, isAliased: false, callee-saved-register: '' }
193 frame-setup PUSH32r killed $esi, implicit-def $esp, implicit $esp
194 CFI_INSTRUCTION def_cfa_offset 8
195 CFI_INSTRUCTION offset $esi, -8
196 $esi = MOV32rm $esp, 1, _, 8, _ :: (load 4 from %fixed-stack.2)
197 DBG_VALUE $esp, 0, !26, !10, debug-location !25
198 DBG_VALUE $esp, 0, !23, !DIExpression(DW_OP_plus_uconst, 8, DW_OP_deref), debug-location !25
199 CALLpcrel32 @getString, csr_32, implicit $esp, implicit-def $esp, implicit-def $eax, debug-location !29
200 $ecx = MOV32rm $eax, 1, _, 0, _, debug-location !29 :: (dereferenceable load 4 from %ir.1)
201 $edx = MOV32rm $eax, 1, _, 4, _, debug-location !29 :: (dereferenceable load 4 from %ir.1 + 4)
202 MOV32mr $esi, 1, _, 0, _, killed $ecx, debug-location !29 :: (store 4 into %ir.0)
203 MOV32mr $esi, 1, _, 4, _, killed $edx, debug-location !29 :: (store 4 into %ir.0 + 4)
204 $eax = MOV32rm killed $eax, 1, _, 8, _, debug-location !29 :: (dereferenceable load 4 from %ir.1 + 8)
205 MOV32mr $esi, 1, _, 8, _, killed $eax, debug-location !29 :: (store 4 into %ir.0 + 8)
206 $eax = COPY killed $esi, debug-location !30
207 $esi = POP32r implicit-def $esp, implicit $esp, debug-location !30
208 RET 0, $eax, debug-location !30
214 exposesReturnsTwice: false
216 regBankSelected: false
218 tracksRegLiveness: true
222 isFrameAddressTaken: false
223 isReturnAddressTaken: false
233 hasOpaqueSPAdjustment: false
235 hasMustTailInVarArgFunc: false
239 - { id: 0, type: default, offset: 4, size: 4, alignment: 4, stack-id: 0,
240 isImmutable: true, isAliased: false, callee-saved-register: '' }
241 - { id: 1, type: default, offset: 0, size: 4, alignment: 4, stack-id: 0,
242 isImmutable: true, isAliased: false, callee-saved-register: '' }
247 $eax = MOV32rm $esp, 1, _, 4, _ :: (load 4 from %fixed-stack.1)
248 $eax = MOV32rm killed $eax, 1, _, 0, _, debug-location !34 :: (load 4 from %ir.0)
249 DBG_VALUE debug-use $eax, 0, !35, !DIExpression(DW_OP_constu, 4, DW_OP_minus), debug-location !34
250 $eax = ADD32rm killed $eax, $esp, 1, _, 8, _, implicit-def dead $eflags, debug-location !36 :: (load 4 from %fixed-stack.0)
251 RET 0, $eax, debug-location !36