17093c810SJeremy Morse; RUN: llc %s -o - -stop-before=phi-node-elimination \ 27093c810SJeremy Morse; RUN: -experimental-debug-variable-locations=true \ 37093c810SJeremy Morse; RUN: | FileCheck %s --check-prefixes=DYN_LOWERED 47093c810SJeremy Morse 57093c810SJeremy Morse;; Copy of instr-ref-dyn-alloca-win32.ll, targetting 64 bit Windows. Here, 67093c810SJeremy Morse;; _chkstk doesn't return with a modified stack pointer, instead we have to 77093c810SJeremy Morse;; edit it with our own subtract operation. Check that it's labelled and the 87093c810SJeremy Morse;; substitution is correct. This also covers the code paths for non-Windows on 97093c810SJeremy Morse;; x86. 107093c810SJeremy Morse 117093c810SJeremy Morse; DYN_LOWERED: debugValueSubstitutions: 127093c810SJeremy Morse; DYN_LOWERED-NEXT: - { srcinst: 1, srcop: 2, dstinst: 2, dstop: 0, subreg: 0 } 137093c810SJeremy Morse; DYN_LOWERED: SUB64rr $rsp, killed $rax, {{.*}} debug-instr-number 2, 147093c810SJeremy Morse 157093c810SJeremy Morsesource_filename = "test/DebugInfo/COFF/types-array-advanced.ll" 167093c810SJeremy Morsetarget datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" 177093c810SJeremy Morsetarget triple = "x86_64-pc-windows-msvc19.0.24210" 187093c810SJeremy Morse 197093c810SJeremy Morse%struct.incomplete_struct = type { i32 } 207093c810SJeremy Morse 217093c810SJeremy Morse@"\01?multi_dim_arr@@3PAY146DA" = global [2 x [5 x [7 x i8]]] zeroinitializer, align 1, !dbg !0 22*5a288fa3SNikita Popov@"\01?p_incomplete_struct_arr@@3PAY02Uincomplete_struct@@A" = global ptr null, align 4, !dbg !6 237093c810SJeremy Morse@"\01?incomplete_struct_arr@@3PAUincomplete_struct@@A" = global [3 x %struct.incomplete_struct] zeroinitializer, align 4, !dbg !16 247093c810SJeremy Morse@"\01?typedef_arr@@3SDHD" = constant [4 x i32] zeroinitializer, align 4, !dbg !18 257093c810SJeremy Morse 267093c810SJeremy Morse; Function Attrs: nounwind 277093c810SJeremy Morsedefine void @"\01?foo@@YAXH@Z"(i32 %x) #0 !dbg !35 { 287093c810SJeremy Morseentry: 297093c810SJeremy Morse %x.addr = alloca i32, align 4 30*5a288fa3SNikita Popov %saved_stack = alloca ptr, align 4 31*5a288fa3SNikita Popov store i32 %x, ptr %x.addr, align 4 32*5a288fa3SNikita Popov call void @llvm.dbg.declare(metadata ptr %x.addr, metadata !38, metadata !39), !dbg !40 33*5a288fa3SNikita Popov %0 = load i32, ptr %x.addr, align 4, !dbg !41 34*5a288fa3SNikita Popov %1 = call ptr @llvm.stacksave(), !dbg !42 35*5a288fa3SNikita Popov store ptr %1, ptr %saved_stack, align 4, !dbg !42 367093c810SJeremy Morse %vla = alloca i32, i32 %0, align 4, !dbg !42 37*5a288fa3SNikita Popov call void @llvm.dbg.declare(metadata ptr %vla, metadata !43, metadata !47), !dbg !48 38*5a288fa3SNikita Popov store i32 0, ptr %vla, align 4, !dbg !50 39*5a288fa3SNikita Popov %2 = load ptr, ptr %saved_stack, align 4, !dbg !51 40*5a288fa3SNikita Popov call void @llvm.stackrestore(ptr %2), !dbg !51 417093c810SJeremy Morse ret void, !dbg !51 427093c810SJeremy Morse} 437093c810SJeremy Morse 447093c810SJeremy Morse; Function Attrs: nounwind readnone 457093c810SJeremy Morsedeclare void @llvm.dbg.declare(metadata, metadata, metadata) 467093c810SJeremy Morse 477093c810SJeremy Morse; Function Attrs: nounwind 48*5a288fa3SNikita Popovdeclare ptr @llvm.stacksave() 497093c810SJeremy Morse 507093c810SJeremy Morse; Function Attrs: nounwind 51*5a288fa3SNikita Popovdeclare void @llvm.stackrestore(ptr) 527093c810SJeremy Morse 537093c810SJeremy Morse!llvm.dbg.cu = !{!2} 547093c810SJeremy Morse!llvm.module.flags = !{!32, !33} 557093c810SJeremy Morse!llvm.ident = !{!34} 567093c810SJeremy Morse 577093c810SJeremy Morse!0 = distinct !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 587093c810SJeremy Morse!1 = !DIGlobalVariable(name: "multi_dim_arr", linkageName: "\01?multi_dim_arr@@3PAY146DA", scope: !2, file: !3, line: 1, type: !26, isLocal: false, isDefinition: true) 597093c810SJeremy Morse!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.9.0 (trunk 273874)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) 607093c810SJeremy Morse!3 = !DIFile(filename: "t.cpp", directory: "/") 617093c810SJeremy Morse!4 = !{} 627093c810SJeremy Morse!5 = !{!0, !6, !16, !18} 637093c810SJeremy Morse!6 = distinct !DIGlobalVariableExpression(var: !7, expr: !DIExpression()) 647093c810SJeremy Morse!7 = !DIGlobalVariable(name: "p_incomplete_struct_arr", linkageName: "\01?p_incomplete_struct_arr@@3PAY02Uincomplete_struct@@A", scope: !2, file: !3, line: 3, type: !8, isLocal: false, isDefinition: true) 657093c810SJeremy Morse!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 32, align: 32) 667093c810SJeremy Morse!9 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, elements: !14) 677093c810SJeremy Morse!10 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "incomplete_struct", file: !3, line: 4, size: 32, align: 32, elements: !11, identifier: ".?AUincomplete_struct@@") 687093c810SJeremy Morse!11 = !{!12} 697093c810SJeremy Morse!12 = !DIDerivedType(tag: DW_TAG_member, name: "s1", scope: !10, file: !3, line: 5, baseType: !13, size: 32, align: 32) 707093c810SJeremy Morse!13 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 717093c810SJeremy Morse!14 = !{!15} 727093c810SJeremy Morse!15 = !DISubrange(count: 3) 737093c810SJeremy Morse!16 = distinct !DIGlobalVariableExpression(var: !17, expr: !DIExpression()) 747093c810SJeremy Morse!17 = !DIGlobalVariable(name: "incomplete_struct_arr", linkageName: "\01?incomplete_struct_arr@@3PAUincomplete_struct@@A", scope: !2, file: !3, line: 6, type: !9, isLocal: false, isDefinition: true) 757093c810SJeremy Morse!18 = distinct !DIGlobalVariableExpression(var: !19, expr: !DIExpression()) 767093c810SJeremy Morse!19 = !DIGlobalVariable(name: "typedef_arr", linkageName: "\01?typedef_arr@@3SDHD", scope: !2, file: !3, line: 14, type: !20, isLocal: false, isDefinition: true) 777093c810SJeremy Morse!20 = !DICompositeType(tag: DW_TAG_array_type, baseType: !21, size: 128, align: 32, elements: !24) 787093c810SJeremy Morse!21 = !DIDerivedType(tag: DW_TAG_typedef, name: "T_INT", file: !3, line: 13, baseType: !22) 797093c810SJeremy Morse!22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !23) 807093c810SJeremy Morse!23 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !13) 817093c810SJeremy Morse!24 = !{!25} 827093c810SJeremy Morse!25 = !DISubrange(count: 4) 837093c810SJeremy Morse!26 = !DICompositeType(tag: DW_TAG_array_type, baseType: !27, size: 560, align: 8, elements: !28) 847093c810SJeremy Morse!27 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) 857093c810SJeremy Morse!28 = !{!29, !30, !31} 867093c810SJeremy Morse!29 = !DISubrange(count: 2) 877093c810SJeremy Morse!30 = !DISubrange(count: 5) 887093c810SJeremy Morse!31 = !DISubrange(count: 7) 897093c810SJeremy Morse!32 = !{i32 2, !"CodeView", i32 1} 907093c810SJeremy Morse!33 = !{i32 2, !"Debug Info Version", i32 3} 917093c810SJeremy Morse!34 = !{!"clang version 3.9.0 (trunk 273874)"} 927093c810SJeremy Morse!35 = distinct !DISubprogram(name: "foo", linkageName: "\01?foo@@YAXH@Z", scope: !3, file: !3, line: 8, type: !36, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4) 937093c810SJeremy Morse!36 = !DISubroutineType(types: !37) 947093c810SJeremy Morse!37 = !{null, !13} 957093c810SJeremy Morse!38 = !DILocalVariable(name: "x", arg: 1, scope: !35, file: !3, line: 8, type: !13) 967093c810SJeremy Morse!39 = !DIExpression() 977093c810SJeremy Morse!40 = !DILocation(line: 8, column: 14, scope: !35) 987093c810SJeremy Morse!41 = !DILocation(line: 9, column: 21, scope: !35) 997093c810SJeremy Morse!42 = !DILocation(line: 9, column: 4, scope: !35) 1007093c810SJeremy Morse!43 = !DILocalVariable(name: "dyn_size_arr", scope: !35, file: !3, line: 9, type: !44) 1017093c810SJeremy Morse!44 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, align: 32, elements: !45) 1027093c810SJeremy Morse!45 = !{!46} 1037093c810SJeremy Morse!46 = !DISubrange(count: -1) 1047093c810SJeremy Morse!47 = !DIExpression(DW_OP_deref) 1057093c810SJeremy Morse!48 = !DILocation(line: 9, column: 8, scope: !35) 1067093c810SJeremy Morse!49 = !DILocation(line: 10, column: 4, scope: !35) 1077093c810SJeremy Morse!50 = !DILocation(line: 10, column: 20, scope: !35) 1087093c810SJeremy Morse!51 = !DILocation(line: 11, column: 1, scope: !35) 1097093c810SJeremy Morse 110