1# RUN: llc -start-after=livedebugvalues -filetype=obj -o - %s \ 2# RUN: | llvm-dwarfdump - | FileCheck %s 3# CHECK: .debug_info contents: 4# CHECK: DW_TAG_formal_parameter 5# CHECK: DW_TAG_formal_parameter 6# CHECK-NEXT: DW_AT_location 7# CHECK-NEXT: [0x0000000000000010, 0x0000000000000014): DW_OP_reg1 W1 8# CHECK-NEXT: [0x0000000000000014, 0x0000000000000038): DW_OP_breg31 WSP+8 9# CHECK-NEXT: DW_AT_name {{.*}}"y" 10 11--- | 12 ; Generated at -Os from: 13 ; struct Rect { 14 ; double x, y, w, h; 15 ; }; 16 ; void g(struct Rect); 17 ; void h(int *); 18 ; int f(int x, int y, struct Rect s) { 19 ; g(s); 20 ; if (y) 21 ; h(&x); 22 ; return 0; 23 ; } 24 source_filename = "/tmp/clobber.c" 25 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" 26 target triple = "arm64-apple-ios" 27 28 %struct.Rect = type { double, double, double, double } 29 30 ; Function Attrs: nounwind optsize ssp 31 define i32 @f(i32 %x, i32 %y, [4 x double] %s.coerce) local_unnamed_addr #0 !dbg !7 { 32 entry: 33 %x.addr = alloca i32, align 4 34 tail call void @llvm.dbg.value(metadata i32 %x, i64 0, metadata !19, metadata !22), !dbg !23 35 store i32 %x, i32* %x.addr, align 4, !tbaa !24 36 tail call void @llvm.dbg.value(metadata i32 %y, i64 0, metadata !20, metadata !22), !dbg !28 37 tail call void @llvm.dbg.declare(metadata %struct.Rect* undef, metadata !21, metadata !22), !dbg !29 38 tail call void @g([4 x double] %s.coerce) #4, !dbg !30 39 %tobool = icmp eq i32 %y, 0, !dbg !31 40 br i1 %tobool, label %if.end, label %if.then, !dbg !33 41 42 if.then: ; preds = %entry 43 tail call void @llvm.dbg.value(metadata i32* %x.addr, i64 0, metadata !19, metadata !22), !dbg !23 44 call void @h(i32* nonnull %x.addr) #4, !dbg !34 45 br label %if.end, !dbg !34 46 47 if.end: ; preds = %if.then, %entry 48 ret i32 0, !dbg !35 49 } 50 51 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 52 declare void @g([4 x double]) local_unnamed_addr #2 53 declare void @h(i32*) local_unnamed_addr #2 54 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 55 declare void @llvm.stackprotector(i8*, i8**) #3 56 57 attributes #0 = { nounwind optsize ssp } 58 attributes #1 = { nounwind readnone speculatable } 59 attributes #2 = { optsize } 60 attributes #3 = { nounwind } 61 attributes #4 = { nounwind optsize } 62 63 !llvm.dbg.cu = !{!0} 64 !llvm.module.flags = !{!3, !4, !5} 65 !llvm.ident = !{!6} 66 67 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 5.0.0 (trunk 302682) (llvm/trunk 302683)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 68 !1 = !DIFile(filename: "/tmp/clobber.c", directory: "/Volumes/Data/apple-internal/swift") 69 !2 = !{} 70 !3 = !{i32 2, !"Dwarf Version", i32 2} 71 !4 = !{i32 2, !"Debug Info Version", i32 3} 72 !5 = !{i32 1, !"PIC Level", i32 2} 73 !6 = !{!"clang version 5.0.0 (trunk 302682) (llvm/trunk 302683)"} 74 !7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 7, type: !8, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !18) 75 !8 = !DISubroutineType(types: !9) 76 !9 = !{!10, !10, !10, !11} 77 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 78 !11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Rect", file: !1, line: 1, size: 256, elements: !12) 79 !12 = !{!13, !15, !16, !17} 80 !13 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !11, file: !1, line: 2, baseType: !14, size: 64) 81 !14 = !DIBasicType(name: "double", size: 64, encoding: DW_ATE_float) 82 !15 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !11, file: !1, line: 2, baseType: !14, size: 64, offset: 64) 83 !16 = !DIDerivedType(tag: DW_TAG_member, name: "w", scope: !11, file: !1, line: 2, baseType: !14, size: 64, offset: 128) 84 !17 = !DIDerivedType(tag: DW_TAG_member, name: "h", scope: !11, file: !1, line: 2, baseType: !14, size: 64, offset: 192) 85 !18 = !{!19, !20, !21} 86 !19 = !DILocalVariable(name: "x", arg: 1, scope: !7, file: !1, line: 7, type: !10) 87 !20 = !DILocalVariable(name: "y", arg: 2, scope: !7, file: !1, line: 7, type: !10) 88 !21 = !DILocalVariable(name: "s", arg: 3, scope: !7, file: !1, line: 7, type: !11) 89 !22 = !DIExpression() 90 !23 = !DILocation(line: 7, column: 11, scope: !7) 91 !24 = !{!25, !25, i64 0} 92 !25 = !{!"int", !26, i64 0} 93 !26 = !{!"omnipotent char", !27, i64 0} 94 !27 = !{!"Simple C/C++ TBAA"} 95 !28 = !DILocation(line: 7, column: 18, scope: !7) 96 !29 = !DILocation(line: 7, column: 33, scope: !7) 97 !30 = !DILocation(line: 8, column: 3, scope: !7) 98 !31 = !DILocation(line: 9, column: 7, scope: !32) 99 !32 = distinct !DILexicalBlock(scope: !7, file: !1, line: 9, column: 7) 100 !33 = !DILocation(line: 9, column: 7, scope: !7) 101 !34 = !DILocation(line: 10, column: 5, scope: !32) 102 !35 = !DILocation(line: 12, column: 3, scope: !7) 103 !36 = !DIExpression(DW_OP_constu, 8, DW_OP_plus) 104 105... 106--- 107name: f 108alignment: 4 109exposesReturnsTwice: false 110legalized: false 111regBankSelected: false 112selected: false 113tracksRegLiveness: true 114liveins: 115 - { reg: '$w0' } 116 - { reg: '$w1' } 117 - { reg: '$d0' } 118 - { reg: '$d1' } 119 - { reg: '$d2' } 120 - { reg: '$d3' } 121frameInfo: 122 isFrameAddressTaken: false 123 isReturnAddressTaken: false 124 hasStackMap: false 125 hasPatchPoint: false 126 stackSize: 32 127 offsetAdjustment: 0 128 maxAlignment: 8 129 adjustsStack: true 130 hasCalls: true 131 maxCallFrameSize: 0 132 hasOpaqueSPAdjustment: false 133 hasVAStart: false 134 hasMustTailInVarArgFunc: false 135stack: 136 - { id: 0, name: x.addr, offset: -20, size: 4, alignment: 4, local-offset: -4 } 137 - { id: 1, type: spill-slot, offset: -24, size: 4, alignment: 4 } 138 - { id: 2, type: spill-slot, offset: -8, size: 8, alignment: 8, callee-saved-register: '$lr' } 139 - { id: 3, type: spill-slot, offset: -16, size: 8, alignment: 8, callee-saved-register: '$fp' } 140body: | 141 bb.0.entry: 142 successors: %bb.2.if.end(0x40000000), %bb.1.if.then(0x40000000) 143 liveins: $w0, $w1, $d0, $d1, $d2, $d3, $lr 144 145 $sp = frame-setup SUBXri $sp, 32, 0 146 frame-setup STPXi killed $fp, killed $lr, $sp, 2 :: (store 8 into %stack.3), (store 8 into %stack.2) 147 $fp = frame-setup ADDXri $sp, 16, 0 148 DBG_VALUE $w0, _, !19, !22, debug-location !23 149 STURWi killed $w0, $fp, -4 :: (store 4 into %stack.0.x.addr) 150 DBG_VALUE $w1, _, !20, !22, debug-location !28 151 STRWui killed $w1, $sp, 2, debug-location !30 :: (store 4 into %stack.1) 152 DBG_VALUE $sp, 0, !20, !36, debug-location !28 153 BL @g, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $d0, implicit killed $d1, implicit killed $d2, implicit killed $d3, implicit-def $sp, debug-location !30 154 $w0 = LDRWui $sp, 2, debug-location !33 :: (load 4 from %stack.1) 155 CBZW killed $w0, %bb.2.if.end, debug-location !33 156 157 bb.1.if.then: 158 successors: %bb.2.if.end(0x80000000) 159 160 DBG_VALUE $sp, 0, !20, !36, debug-location !28 161 $x0 = SUBXri $fp, 4, 0 162 DBG_VALUE $x0, _, !19, !22, debug-location !23 163 BL @h, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, debug-location !34 164 165 bb.2.if.end: 166 DBG_VALUE $sp, 0, !20, !36, debug-location !28 167 $w8 = MOVZWi 0, 0 168 $x0 = ORRXrs $xzr, undef $x8, 0, implicit killed $w8, debug-location !35 169 $fp, $lr = LDPXi $sp, 2, debug-location !35 :: (load 8 from %stack.3), (load 8 from %stack.2) 170 $sp = ADDXri $sp, 32, 0, debug-location !35 171 RET undef $lr, implicit killed $w0, debug-location !35 172 173... 174