1*9880d681SAndroid Build Coastguard Worker; RUN: llc -O0 %s -filetype=obj -o %t.o 2*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dwarfdump -debug-dump=loc %t.o | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker; 4*9880d681SAndroid Build Coastguard Worker; rdar://problem/15928306 5*9880d681SAndroid Build Coastguard Worker; 6*9880d681SAndroid Build Coastguard Worker; Test that we can emit debug info for aggregate values that are split 7*9880d681SAndroid Build Coastguard Worker; up across multiple registers by SROA. 8*9880d681SAndroid Build Coastguard Worker; 9*9880d681SAndroid Build Coastguard Worker; // Compile with -O1. 10*9880d681SAndroid Build Coastguard Worker; typedef struct { long int a; int b;} S; 11*9880d681SAndroid Build Coastguard Worker; 12*9880d681SAndroid Build Coastguard Worker; int foo(S s) { 13*9880d681SAndroid Build Coastguard Worker; return s.b; 14*9880d681SAndroid Build Coastguard Worker; } 15*9880d681SAndroid Build Coastguard Worker; 16*9880d681SAndroid Build Coastguard Worker; 17*9880d681SAndroid Build Coastguard Worker; CHECK: .debug_loc contents: 18*9880d681SAndroid Build Coastguard Worker; 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Worker; 0x0000000000000000 - 0x0000000000000006: rdi, piece 0x00000008, rsi, piece 0x00000004 21*9880d681SAndroid Build Coastguard Worker; CHECK: Beginning address offset: 0x0000000000000000 22*9880d681SAndroid Build Coastguard Worker; CHECK: Ending address offset: [[LTMP3:.*]] 23*9880d681SAndroid Build Coastguard Worker; CHECK: Location description: 55 93 08 54 93 04 24*9880d681SAndroid Build Coastguard Worker; 0x0000000000000006 - 0x0000000000000008: rbp-8, piece 0x00000008, rax, piece 0x00000004 ) 25*9880d681SAndroid Build Coastguard Worker; CHECK: Beginning address offset: [[LTMP3]] 26*9880d681SAndroid Build Coastguard Worker; CHECK: Ending address offset: [[END:.*]] 27*9880d681SAndroid Build Coastguard Worker; CHECK: Location description: 76 78 93 08 54 93 04 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 30*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-apple-macosx10.9.0" 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind ssp uwtable 33*9880d681SAndroid Build Coastguard Workerdefine i32 @foo(i64 %s.coerce0, i32 %s.coerce1) #0 !dbg !4 { 34*9880d681SAndroid Build Coastguard Workerentry: 35*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.value(metadata i64 %s.coerce0, i64 0, metadata !20, metadata !24), !dbg !21 36*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.value(metadata i32 %s.coerce1, i64 0, metadata !22, metadata !27), !dbg !21 37*9880d681SAndroid Build Coastguard Worker ret i32 %s.coerce1, !dbg !23 38*9880d681SAndroid Build Coastguard Worker} 39*9880d681SAndroid Build Coastguard Worker 40*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone 41*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1 42*9880d681SAndroid Build Coastguard Worker 43*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone 44*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 45*9880d681SAndroid Build Coastguard Worker 46*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind ssp uwtable "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" } 47*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone } 48*9880d681SAndroid Build Coastguard Worker 49*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0} 50*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!17, !18} 51*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!19} 52*9880d681SAndroid Build Coastguard Worker 53*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5 ", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2) 54*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "pieces.c", directory: "") 55*9880d681SAndroid Build Coastguard Worker!2 = !{} 56*9880d681SAndroid Build Coastguard Worker!4 = distinct !DISubprogram(name: "foo", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 3, file: !1, scope: !5, type: !6, variables: !15) 57*9880d681SAndroid Build Coastguard Worker!5 = !DIFile(filename: "pieces.c", directory: "") 58*9880d681SAndroid Build Coastguard Worker!6 = !DISubroutineType(types: !7) 59*9880d681SAndroid Build Coastguard Worker!7 = !{!8, !9} 60*9880d681SAndroid Build Coastguard Worker!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 61*9880d681SAndroid Build Coastguard Worker!9 = !DIDerivedType(tag: DW_TAG_typedef, name: "S", line: 1, file: !1, baseType: !10) 62*9880d681SAndroid Build Coastguard Worker!10 = !DICompositeType(tag: DW_TAG_structure_type, line: 1, size: 128, align: 64, file: !1, elements: !11) 63*9880d681SAndroid Build Coastguard Worker!11 = !{!12, !14} 64*9880d681SAndroid Build Coastguard Worker!12 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 1, size: 64, align: 64, file: !1, scope: !10, baseType: !13) 65*9880d681SAndroid Build Coastguard Worker!13 = !DIBasicType(tag: DW_TAG_base_type, name: "long int", size: 64, align: 64, encoding: DW_ATE_signed) 66*9880d681SAndroid Build Coastguard Worker!14 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 1, size: 32, align: 32, offset: 64, file: !1, scope: !10, baseType: !8) 67*9880d681SAndroid Build Coastguard Worker!15 = !{!16} 68*9880d681SAndroid Build Coastguard Worker!16 = !DILocalVariable(name: "s", line: 3, arg: 1, scope: !4, file: !5, type: !9) 69*9880d681SAndroid Build Coastguard Worker!17 = !{i32 2, !"Dwarf Version", i32 4} 70*9880d681SAndroid Build Coastguard Worker!18 = !{i32 1, !"Debug Info Version", i32 3} 71*9880d681SAndroid Build Coastguard Worker!19 = !{!"clang version 3.5 "} 72*9880d681SAndroid Build Coastguard Worker!20 = !DILocalVariable(name: "s", line: 3, arg: 1, scope: !4, file: !5, type: !9) 73*9880d681SAndroid Build Coastguard Worker!21 = !DILocation(line: 3, scope: !4) 74*9880d681SAndroid Build Coastguard Worker!22 = !DILocalVariable(name: "s", line: 3, arg: 1, scope: !4, file: !5, type: !9) 75*9880d681SAndroid Build Coastguard Worker!23 = !DILocation(line: 4, scope: !4) 76*9880d681SAndroid Build Coastguard Worker!24 = !DIExpression(DW_OP_bit_piece, 0, 64) 77*9880d681SAndroid Build Coastguard Worker!25 = !{} 78*9880d681SAndroid Build Coastguard Worker!27 = !DIExpression(DW_OP_bit_piece, 64, 32) 79