1; RUN: llc -mtriple=x86_64-apple-darwin %s -o - -filetype=obj | \ 2; RUN: llvm-dwarfdump --debug-dump=info - | FileCheck %s 3; 4; Test emitting debug info for fragmented global values. 5; This is a handcrafted example of an SROAed global variable. 6target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 7target triple = "x86_64-apple-macosx10.12.0" 8 9%struct.anon = type { i32, i32 } 10 11; CHECK: DW_TAG_variable 12; CHECK-NEXT: DW_AT_name {{.*}}"point" 13; CHECK-NOT: DW_TAG 14; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x16> 03 04 00 00 00 00 00 00 00 93 04 03 00 00 00 00 00 00 00 00 93 04 ) 15; [0x0000000000000004], piece 0x00000004, [0x0000000000000000], piece 0x00000004 16; CHECK-NOT: DW_TAG 17; CHECK: DW_TAG 18; CHECK: DW_TAG_variable 19; CHECK-NEXT: DW_AT_name {{.*}}"part_const" 20; CHECK-NOT: DW_TAG 21; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x10> 03 08 00 00 00 00 00 00 00 93 04 10 02 9f 93 04 ) 22; [0x0000000000000008], piece 0x00000004, constu 0x00000002, stack-value, piece 0x00000004 23; CHECK-NOT: DW_TAG 24; CHECK: DW_TAG_variable 25; CHECK-NEXT: DW_AT_name {{.*}}"full_const" 26; CHECK-NOT: DW_TAG 27; CHECK: DW_AT_location [DW_FORM_exprloc] (<0xa> 10 01 9f 93 04 10 02 9f 93 04 ) 28; constu 0x00000001, stack-value, piece 0x00000004, constu 0x00000002, stack-value, piece 0x00000004 29; CHECK-NOT: DW_TAG 30@point.y = global i32 2, align 4, !dbg !13 31@point.x = global i32 1, align 4, !dbg !12 32 33@part_const.x = global i32 1, align 4, !dbg !15 34 35!llvm.dbg.cu = !{!1} 36!llvm.module.flags = !{!10, !11} 37 38!0 = distinct !DIGlobalVariable(name: "point", scope: !1, file: !2, line: 1, type: !5, isLocal: false, isDefinition: true) 39!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4) 40!2 = !DIFile(filename: "g.c", directory: "/") 41!3 = !{} 42!4 = !{!12, !13, !14, !15, !17, !18} 43!5 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !2, line: 1, size: 64, elements: !6) 44!6 = !{!7, !9} 45!7 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !5, file: !2, line: 1, baseType: !8, size: 32) 46!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 47!9 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !5, file: !2, line: 1, baseType: !8, size: 32, offset: 32) 48!10 = !{i32 2, !"Dwarf Version", i32 4} 49!11 = !{i32 2, !"Debug Info Version", i32 3} 50!12 = !DIGlobalVariableExpression(var: !0, expr: !DIExpression(DW_OP_LLVM_fragment, 0, 32)) 51!13 = !DIGlobalVariableExpression(var: !0, expr: !DIExpression(DW_OP_LLVM_fragment, 32, 32)) 52!14 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression(DW_OP_LLVM_fragment, 0, 32)) 53!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression(DW_OP_constu, 2, 54 DW_OP_stack_value, DW_OP_LLVM_fragment, 32, 32)) 55!16 = distinct !DIGlobalVariable(name: "part_const", scope: !1, file: !2, line: 1, type: !5, isLocal: false, isDefinition: true) 56!17 = !DIGlobalVariableExpression(var: !19, expr: !DIExpression(DW_OP_constu, 1, 57 DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32)) 58!18 = !DIGlobalVariableExpression(var: !19, expr: !DIExpression(DW_OP_constu, 2, 59 DW_OP_stack_value, DW_OP_LLVM_fragment, 32, 32)) 60!19 = distinct !DIGlobalVariable(name: "full_const", scope: !1, file: !2, line: 1, type: !5, isLocal: false, isDefinition: true) 61