174 lines · plain
1# RUN: llc -start-before=aarch64-asm-printer -filetype=obj -o - %s \2# RUN: | llvm-dwarfdump - | FileCheck %s3# CHECK: .debug_info contents:4# CHECK: DW_TAG_formal_parameter5# CHECK: DW_TAG_formal_parameter6# CHECK-NEXT: DW_AT_location7# CHECK-NEXT: [0x0000000000000010, 0x0000000000000014): DW_OP_reg1 W18# CHECK-NEXT: [0x0000000000000014, 0x0000000000000038): DW_OP_breg31 WSP+89# 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 ssp31 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 434 tail call void @llvm.dbg.value(metadata i32 %x, i64 0, metadata !19, metadata !22), !dbg !2335 store i32 %x, ptr %x.addr, align 4, !tbaa !2436 tail call void @llvm.dbg.value(metadata i32 %y, i64 0, metadata !20, metadata !22), !dbg !2837 tail call void @llvm.dbg.declare(metadata ptr undef, metadata !21, metadata !22), !dbg !2938 tail call void @g([4 x double] %s.coerce) #4, !dbg !3039 %tobool = icmp eq i32 %y, 0, !dbg !3140 br i1 %tobool, label %if.end, label %if.then, !dbg !3341 42 if.then: ; preds = %entry43 tail call void @llvm.dbg.value(metadata ptr %x.addr, i64 0, metadata !19, metadata !22), !dbg !2344 call void @h(ptr nonnull %x.addr) #4, !dbg !3445 br label %if.end, !dbg !3446 47 if.end: ; preds = %if.then, %entry48 ret i32 0, !dbg !3549 }50 51 declare void @llvm.dbg.declare(metadata, metadata, metadata) #152 declare void @g([4 x double]) local_unnamed_addr #253 declare void @h(ptr) local_unnamed_addr #254 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #155 declare void @llvm.stackprotector(ptr, ptr) #356 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: f108alignment: 4109exposesReturnsTwice: false110legalized: false111regBankSelected: false112selected: false113tracksRegLiveness: true114liveins:115 - { reg: '$w0' }116 - { reg: '$w1' }117 - { reg: '$d0' }118 - { reg: '$d1' }119 - { reg: '$d2' }120 - { reg: '$d3' }121frameInfo:122 isFrameAddressTaken: false123 isReturnAddressTaken: false124 hasStackMap: false125 hasPatchPoint: false126 stackSize: 32127 offsetAdjustment: 0128 maxAlignment: 8129 adjustsStack: true130 hasCalls: true131 maxCallFrameSize: 0132 hasOpaqueSPAdjustment: false133 hasVAStart: false134 hasMustTailInVarArgFunc: false135stack: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, $lr144 145 $sp = frame-setup SUBXri $sp, 32, 0146 frame-setup STPXi killed $fp, killed $lr, $sp, 2 :: (store (s64) into %stack.3), (store (s64) into %stack.2)147 $fp = frame-setup ADDXri $sp, 16, 0148 DBG_VALUE $w0, _, !19, !22, debug-location !23149 STURWi killed $w0, $fp, -4 :: (store (s32) into %stack.0.x.addr)150 DBG_VALUE $w1, _, !20, !22, debug-location !28151 STRWui killed $w1, $sp, 2, debug-location !30 :: (store (s32) into %stack.1)152 DBG_VALUE $sp, 0, !20, !36, debug-location !28153 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 !30154 $w0 = LDRWui $sp, 2, debug-location !33 :: (load (s32) from %stack.1)155 CBZW killed $w0, %bb.2.if.end, debug-location !33156 157 bb.1.if.then:158 successors: %bb.2.if.end(0x80000000)159 160 DBG_VALUE $sp, 0, !20, !36, debug-location !28161 $x0 = SUBXri $fp, 4, 0162 DBG_VALUE $x0, _, !19, !22, debug-location !23163 BL @h, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, debug-location !34164 165 bb.2.if.end:166 DBG_VALUE $sp, 0, !20, !36, debug-location !28167 $w8 = MOVZWi 0, 0168 $x0 = ORRXrs $xzr, undef $x8, 0, implicit killed $w8, debug-location !35169 $fp, $lr = LDPXi $sp, 2, debug-location !35 :: (load (s64) from %stack.3), (load (s64) from %stack.2)170 $sp = ADDXri $sp, 32, 0, debug-location !35171 RET undef $lr, implicit killed $w0, debug-location !35172 173...174