1; RUN: llc -O0 %s -filetype=obj -o - | llvm-dwarfdump -debug-loc - | FileCheck %s 2; 3; rdar://problem/15928306 4; 5; Test that we can emit debug info for aggregate values that are split 6; up across multiple registers by SROA. 7; 8; // Compile with -O1. 9; typedef struct { long int a; int b;} S; 10; 11; int foo(S s) { 12; return s.b; 13; } 14; 15; 16; CHECK: .debug_loc contents: 17; 18 19; CHECK: (0x0000000000000006, 0x[[LTMP3:.*]]): DW_OP_reg5 RDI, DW_OP_piece 0x8, DW_OP_reg0 RAX, DW_OP_piece 0x4 20; 0x0000000000000006 - 0x0000000000000008: rbp-8, piece 0x8, rax, piece 0x4 ) 21 22target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 23target triple = "x86_64-apple-macosx10.9.0" 24 25; Function Attrs: nounwind ssp uwtable 26define i32 @foo(i64 %s.coerce0, i32 %s.coerce1) #0 !dbg !4 { 27entry: 28 call void @llvm.dbg.value(metadata i64 %s.coerce0, metadata !20, metadata !24), !dbg !21 29 call void @llvm.dbg.value(metadata i32 %s.coerce1, metadata !22, metadata !27), !dbg !21 30 ret i32 %s.coerce1, !dbg !23 31} 32 33; Function Attrs: nounwind readnone 34declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 35 36; Function Attrs: nounwind readnone 37declare void @llvm.dbg.value(metadata, metadata, metadata) #1 38 39attributes #0 = { nounwind ssp uwtable "frame-pointer"="all" } 40attributes #1 = { nounwind readnone } 41 42!llvm.dbg.cu = !{!0} 43!llvm.module.flags = !{!17, !18} 44!llvm.ident = !{!19} 45 46!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) 47!1 = !DIFile(filename: "pieces.c", directory: "") 48!2 = !{} 49!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, retainedNodes: !15) 50!5 = !DIFile(filename: "pieces.c", directory: "") 51!6 = !DISubroutineType(types: !7) 52!7 = !{!8, !9} 53!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 54!9 = !DIDerivedType(tag: DW_TAG_typedef, name: "S", line: 1, file: !1, baseType: !10) 55!10 = !DICompositeType(tag: DW_TAG_structure_type, line: 1, size: 128, align: 64, file: !1, elements: !11) 56!11 = !{!12, !14} 57!12 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 1, size: 64, align: 64, file: !1, scope: !10, baseType: !13) 58!13 = !DIBasicType(tag: DW_TAG_base_type, name: "long int", size: 64, align: 64, encoding: DW_ATE_signed) 59!14 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 1, size: 32, align: 32, offset: 64, file: !1, scope: !10, baseType: !8) 60!15 = !{!16} 61!16 = !DILocalVariable(name: "s", line: 3, arg: 1, scope: !4, file: !5, type: !9) 62!17 = !{i32 2, !"Dwarf Version", i32 4} 63!18 = !{i32 1, !"Debug Info Version", i32 3} 64!19 = !{!"clang version 3.5 "} 65!20 = !DILocalVariable(name: "s", line: 3, arg: 1, scope: !4, file: !5, type: !9) 66!21 = !DILocation(line: 3, scope: !4) 67!22 = !DILocalVariable(name: "s", line: 3, arg: 1, scope: !4, file: !5, type: !9) 68!23 = !DILocation(line: 4, scope: !4) 69!24 = !DIExpression(DW_OP_LLVM_fragment, 0, 64) 70!25 = !{} 71!27 = !DIExpression(DW_OP_LLVM_fragment, 64, 32) 72