1; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t.o -filetype=obj -O0 2; RUN: llvm-dwarfdump %t.o | FileCheck %s 3; 4; Test that on x86_64, the 32-bit subregister esi is emitted as 5; DW_OP_piece 32 of the 64-bit rsi. 6; 7; rdar://problem/16015314 8; 9; CHECK: DW_AT_location [DW_FORM_block1] (<0x03> 54 93 04 ) 10; CHECK: DW_AT_name [DW_FORM_strp]{{.*}} "a" 11; 12; struct bar { 13; int a; 14; int b; 15; }; 16; 17; void doSomething() __attribute__ ((noinline)); 18; 19; void doSomething(struct bar *b) 20; { 21; int a = b->a; 22; printf("%d\n", a); // set breakpoint here 23; } 24; 25; int main() 26; { 27; struct bar myBar = { 3, 4 }; 28; doSomething(&myBar); 29; return 0; 30; } 31 32target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 33target triple = "x86_64-apple-macosx10.9.0" 34 35%struct.bar = type { i32, i32 } 36 37@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 38@main.myBar = private unnamed_addr constant %struct.bar { i32 3, i32 4 }, align 4 39 40; Function Attrs: noinline nounwind ssp uwtable 41define void @doSomething(%struct.bar* nocapture readonly %b) #0 { 42entry: 43 tail call void @llvm.dbg.value(metadata %struct.bar* %b, i64 0, metadata !15, metadata !{!"0x102"}), !dbg !25 44 %a1 = getelementptr inbounds %struct.bar* %b, i64 0, i32 0, !dbg !26 45 %0 = load i32* %a1, align 4, !dbg !26, !tbaa !27 46 tail call void @llvm.dbg.value(metadata i32 %0, i64 0, metadata !16, metadata !{!"0x102"}), !dbg !26 47 %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32 %0) #4, !dbg !32 48 ret void, !dbg !33 49} 50 51; Function Attrs: nounwind readnone 52declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 53 54; Function Attrs: nounwind 55declare i32 @printf(i8* nocapture readonly, ...) #2 56 57; Function Attrs: nounwind ssp uwtable 58define i32 @main() #3 { 59entry: 60 %myBar = alloca i64, align 8, !dbg !34 61 %tmpcast = bitcast i64* %myBar to %struct.bar*, !dbg !34 62 tail call void @llvm.dbg.declare(metadata %struct.bar* %tmpcast, metadata !21, metadata !{!"0x102"}), !dbg !34 63 store i64 17179869187, i64* %myBar, align 8, !dbg !34 64 call void @doSomething(%struct.bar* %tmpcast), !dbg !35 65 ret i32 0, !dbg !36 66} 67 68; Function Attrs: nounwind readnone 69declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 70 71attributes #0 = { noinline nounwind ssp uwtable } 72attributes #1 = { nounwind readnone } 73attributes #2 = { nounwind } 74attributes #3 = { nounwind ssp uwtable } 75attributes #4 = { nounwind } 76 77!llvm.dbg.cu = !{!0} 78!llvm.module.flags = !{!22, !23} 79!llvm.ident = !{!24} 80 81!0 = !{!"0x11\0012\00clang version 3.5 \001\00\000\00\001", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [subregisters.c] [DW_LANG_C99] 82!1 = !{!"subregisters.c", !""} 83!2 = !{} 84!3 = !{!4, !17} 85!4 = !{!"0x2e\00doSomething\00doSomething\00\0010\000\001\000\006\00256\001\0011", !1, !5, !6, null, void (%struct.bar*)* @doSomething, null, null, !14} ; [ DW_TAG_subprogram ] [line 10] [def] [scope 11] [doSomething] 86!5 = !{!"0x29", !1} ; [ DW_TAG_file_type ] [subregisters.c] 87!6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] 88!7 = !{null, !8} 89!8 = !{!"0xf\00\000\0064\0064\000\000", null, null, !9} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from bar] 90!9 = !{!"0x13\00bar\003\0064\0032\000\000\000", !1, null, null, !10, null, null, null} ; [ DW_TAG_structure_type ] [bar] [line 3, size 64, align 32, offset 0] [def] [from ] 91!10 = !{!11, !13} 92!11 = !{!"0xd\00a\004\0032\0032\000\000", !1, !9, !12} ; [ DW_TAG_member ] [a] [line 4, size 32, align 32, offset 0] [from int] 93!12 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] 94!13 = !{!"0xd\00b\005\0032\0032\0032\000", !1, !9, !12} ; [ DW_TAG_member ] [b] [line 5, size 32, align 32, offset 32] [from int] 95!14 = !{!15, !16} 96!15 = !{!"0x101\00b\0016777226\000", !4, !5, !8} ; [ DW_TAG_arg_variable ] [b] [line 10] 97!16 = !{!"0x100\00a\0012\000", !4, !5, !12} ; [ DW_TAG_auto_variable ] [a] [line 12] 98!17 = !{!"0x2e\00main\00main\00\0016\000\001\000\006\000\001\0017", !1, !5, !18, null, i32 ()* @main, null, null, !20} ; [ DW_TAG_subprogram ] [line 16] [def] [scope 17] [main] 99!18 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !19, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] 100!19 = !{!12} 101!20 = !{!21} 102!21 = !{!"0x100\00myBar\0018\000", !17, !5, !9} ; [ DW_TAG_auto_variable ] [myBar] [line 18] 103!22 = !{i32 2, !"Dwarf Version", i32 2} 104!23 = !{i32 1, !"Debug Info Version", i32 2} 105!24 = !{!"clang version 3.5 "} 106!25 = !MDLocation(line: 10, scope: !4) 107!26 = !MDLocation(line: 12, scope: !4) 108!27 = !{!28, !29, i64 0} 109!28 = !{!"bar", !29, i64 0, !29, i64 4} 110!29 = !{!"int", !30, i64 0} 111!30 = !{!"omnipotent char", !31, i64 0} 112!31 = !{!"Simple C/C++ TBAA"} 113!32 = !MDLocation(line: 13, scope: !4) 114!33 = !MDLocation(line: 14, scope: !4) 115!34 = !MDLocation(line: 18, scope: !17) 116!35 = !MDLocation(line: 19, scope: !17) 117!36 = !MDLocation(line: 20, scope: !17) 118