1# RUN: llc -start-after=prologepilog -filetype=obj -O0 %s -o - | llvm-readobj -codeview | FileCheck %s 2# 3# (DW_OP_plus_uconst 12) 4# CHECK: LocalSym { 5# CHECK-NEXT: Kind: S_LOCAL (0x113E) 6# CHECK-NEXT: Type: string* (0x 7# CHECK-NEXT: Flags [ (0x0) 8# CHECK-NEXT: ] 9# CHECK-NEXT: VarName: Str 10# CHECK-NEXT: } 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: 20# CHECK-NEXT: Range: 21# CHECK-NEXT: } 22# CHECK-NEXT: } 23# (DW_OP_plus_uconst, 8, DW_OP_deref) 24# CHECK: LocalSym { 25# CHECK-NEXT: Kind: S_LOCAL (0x113E) 26# CHECK-NEXT: Type: string& (0x 27# CHECK-NEXT: Flags [ (0x0) 28# CHECK-NEXT: ] 29# CHECK-NEXT: VarName: Result 30# CHECK-NEXT: } 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: 40# CHECK-NEXT: Range: 41# CHECK-NEXT: } 42# CHECK-NEXT: } 43# (DW_OP_constu, 4, DW_OP_minus) 44# CHECK: LocalSym { 45# CHECK-NEXT: Kind: S_LOCAL (0x113E) 46# CHECK-NEXT: Type: long (0x12) 47# CHECK-NEXT: Flags [ (0x0) 48# CHECK-NEXT: ] 49# CHECK-NEXT: VarName: Bytes 50# CHECK-NEXT: } 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: 60# CHECK-NEXT: Range: 61# CHECK-NEXT: } 62# CHECK-NEXT: } 63--- | 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" 68 69 %struct.string = type { i32, i32, i8* } 70 71 define void @fun(%struct.string* noalias sret %agg.result, %struct.string* noalias %str) !dbg !12 { 72 entry: 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 79 ret void, !dbg !30 80 } 81 82 define i32 @len(%struct.string* %s, i32 %acc) !dbg !31 { 83 entry: 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 88 ret i32 %1, !dbg !36 89 } 90 91 ; Function Attrs: nounwind readnone speculatable 92 declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 93 94 ; Function Attrs: nounwind readnone speculatable 95 declare void @llvm.dbg.value(metadata, metadata, metadata) #0 96 97 declare dereferenceable(12) %struct.string* @getString() 98 99 ; Function Attrs: argmemonly nounwind 100 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i32, i1) #1 101 102 ; Function Attrs: nounwind 103 declare void @llvm.stackprotector(i8*, i8**) #2 104 105 attributes #0 = { nounwind readnone speculatable } 106 attributes #1 = { argmemonly nounwind } 107 attributes #2 = { nounwind } 108 109 !llvm.dbg.cu = !{!0} 110 !llvm.linker.options = !{!3, !4} 111 !llvm.module.flags = !{!5, !6, !7, !8} 112 !llvm.ident = !{!9} 113 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") 116 !2 = !{} 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) 128 !14 = !{!15} 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) 147 !33 = !{!18} 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) 151 152... 153--- 154name: fun 155alignment: 4 156exposesReturnsTwice: false 157legalized: false 158regBankSelected: false 159selected: false 160tracksRegLiveness: true 161registers: 162liveins: 163frameInfo: 164 isFrameAddressTaken: false 165 isReturnAddressTaken: false 166 hasStackMap: false 167 hasPatchPoint: false 168 stackSize: 4 169 offsetAdjustment: 0 170 maxAlignment: 4 171 adjustsStack: true 172 hasCalls: true 173 stackProtector: '' 174 maxCallFrameSize: 0 175 hasOpaqueSPAdjustment: false 176 hasVAStart: false 177 hasMustTailInVarArgFunc: false 178 savePoint: '' 179 restorePoint: '' 180fixedStack: 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: '' } 187stack: 188constants: 189body: | 190 bb.0.entry: 191 liveins: $esi 192 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 debug-use $esp, 0, !26, !10, debug-location !25 198 DBG_VALUE debug-use $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 209 210... 211--- 212name: len 213alignment: 4 214exposesReturnsTwice: false 215legalized: false 216regBankSelected: false 217selected: false 218tracksRegLiveness: true 219registers: 220liveins: 221frameInfo: 222 isFrameAddressTaken: false 223 isReturnAddressTaken: false 224 hasStackMap: false 225 hasPatchPoint: false 226 stackSize: 0 227 offsetAdjustment: 0 228 maxAlignment: 4 229 adjustsStack: false 230 hasCalls: false 231 stackProtector: '' 232 maxCallFrameSize: 0 233 hasOpaqueSPAdjustment: false 234 hasVAStart: false 235 hasMustTailInVarArgFunc: false 236 savePoint: '' 237 restorePoint: '' 238fixedStack: 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: '' } 243stack: 244constants: 245body: | 246 bb.0.entry: 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 252 253... 254