1; RUN: llc -arm-global-merge -global-merge-group-by-use=false -filetype=obj < %s | llvm-dwarfdump -debug-info -v - | FileCheck %s 2 3source_filename = "test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll" 4target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32" 5target triple = "thumbv7-apple-darwin10" 6 7@x1 = internal global i8 1, align 1, !dbg !0 8@x2 = internal global i8 1, align 1, !dbg !4 9@x3 = internal global i8 1, align 1, !dbg !6 10@x4 = internal global i8 1, align 1, !dbg !8 11@x5 = global i8 1, align 1, !dbg !10 12 13; CHECK: DW_TAG_variable 14; CHECK-NOT: DW_TAG 15; CHECK: DW_AT_name {{.*}} "x1" 16; CHECK-NOT: {{DW_TAG|NULL}} 17; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr [[ADDR:0x[0-9a-fA-F]+]]) 18; CHECK: DW_TAG_variable 19; CHECK-NOT: DW_TAG 20; CHECK: DW_AT_name {{.*}} "x2" 21; CHECK-NOT: {{DW_TAG|NULL}} 22; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr [[ADDR]], DW_OP_plus_uconst 0x1) 23 24; Function Attrs: nounwind optsize 25define zeroext i8 @get1(i8 zeroext %a) #0 !dbg !16 { 26entry: 27 tail call void @llvm.dbg.value(metadata i8 %a, metadata !20, metadata !23), !dbg !24 28 %0 = load i8, i8* @x1, align 4, !dbg !24 29 tail call void @llvm.dbg.value(metadata i8 %0, metadata !21, metadata !23), !dbg !24 30 store i8 %a, i8* @x1, align 4, !dbg !24 31 ret i8 %0, !dbg !25 32} 33 34; Function Attrs: nounwind readnone 35declare void @llvm.dbg.value(metadata, metadata, metadata) #1 36 37; Function Attrs: nounwind optsize 38define zeroext i8 @get2(i8 zeroext %a) #0 !dbg !26 { 39entry: 40 tail call void @llvm.dbg.value(metadata i8 %a, metadata !28, metadata !23), !dbg !31 41 %0 = load i8, i8* @x2, align 4, !dbg !31 42 tail call void @llvm.dbg.value(metadata i8 %0, metadata !29, metadata !23), !dbg !31 43 store i8 %a, i8* @x2, align 4, !dbg !31 44 ret i8 %0, !dbg !32 45} 46 47; Function Attrs: nounwind optsize 48 49define zeroext i8 @get3(i8 zeroext %a) #0 !dbg !33 { 50entry: 51 tail call void @llvm.dbg.value(metadata i8 %a, metadata !35, metadata !23), !dbg !38 52 %0 = load i8, i8* @x3, align 4, !dbg !38 53 tail call void @llvm.dbg.value(metadata i8 %0, metadata !36, metadata !23), !dbg !38 54 store i8 %a, i8* @x3, align 4, !dbg !38 55 ret i8 %0, !dbg !39 56} 57 58; Function Attrs: nounwind optsize 59 60define zeroext i8 @get4(i8 zeroext %a) #0 !dbg !40 { 61entry: 62 tail call void @llvm.dbg.value(metadata i8 %a, metadata !42, metadata !23), !dbg !45 63 %0 = load i8, i8* @x4, align 4, !dbg !45 64 tail call void @llvm.dbg.value(metadata i8 %0, metadata !43, metadata !23), !dbg !45 65 store i8 %a, i8* @x4, align 4, !dbg !45 66 ret i8 %0, !dbg !46 67} 68 69; Function Attrs: nounwind optsize 70 71define zeroext i8 @get5(i8 zeroext %a) #0 !dbg !47 { 72entry: 73 tail call void @llvm.dbg.value(metadata i8 %a, metadata !49, metadata !23), !dbg !52 74 %0 = load i8, i8* @x5, align 4, !dbg !52 75 tail call void @llvm.dbg.value(metadata i8 %0, metadata !50, metadata !23), !dbg !52 76 store i8 %a, i8* @x5, align 4, !dbg !52 77 ret i8 %0, !dbg !53 78} 79 80attributes #0 = { nounwind optsize } 81attributes #1 = { nounwind readnone } 82 83!llvm.dbg.cu = !{!12} 84!llvm.module.flags = !{!15} 85 86!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 87!1 = !DIGlobalVariable(name: "x1", scope: !2, file: !2, line: 3, type: !3, isLocal: true, isDefinition: true) 88!2 = !DIFile(filename: "foo.c", directory: "/tmp/") 89!3 = !DIBasicType(name: "_Bool", size: 8, align: 8, encoding: DW_ATE_boolean) 90!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression()) 91!5 = !DIGlobalVariable(name: "x2", scope: !2, file: !2, line: 6, type: !3, isLocal: true, isDefinition: true) 92!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression()) 93!7 = !DIGlobalVariable(name: "x3", scope: !2, file: !2, line: 9, type: !3, isLocal: true, isDefinition: true) 94!8 = !DIGlobalVariableExpression(var: !9, expr: !DIExpression()) 95!9 = !DIGlobalVariable(name: "x4", scope: !2, file: !2, line: 12, type: !3, isLocal: true, isDefinition: true) 96!10 = !DIGlobalVariableExpression(var: !11, expr: !DIExpression()) 97!11 = !DIGlobalVariable(name: "x5", scope: !2, file: !2, line: 15, type: !3, isLocal: false, isDefinition: true) 98!12 = distinct !DICompileUnit(language: DW_LANG_C89, file: !2, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2369.8)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !13, retainedTypes: !13, globals: !14, imports: !13) 99!13 = !{} 100!14 = !{!0, !4, !6, !8, !10} 101!15 = !{i32 1, !"Debug Info Version", i32 3} 102!16 = distinct !DISubprogram(name: "get1", linkageName: "get1", scope: !2, file: !2, line: 4, type: !17, isLocal: false, isDefinition: true, scopeLine: 4, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !12, retainedNodes: !19) 103!17 = !DISubroutineType(types: !18) 104!18 = !{!3, !3} 105!19 = !{!20, !21} 106!20 = !DILocalVariable(name: "a", arg: 1, scope: !16, file: !2, line: 4, type: !3) 107!21 = !DILocalVariable(name: "b", scope: !22, file: !2, line: 4, type: !3) 108!22 = distinct !DILexicalBlock(scope: !16, file: !2, line: 4) 109!23 = !DIExpression() 110!24 = !DILocation(line: 4, scope: !16) 111!25 = !DILocation(line: 4, scope: !22) 112!26 = distinct !DISubprogram(name: "get2", linkageName: "get2", scope: !2, file: !2, line: 7, type: !17, isLocal: false, isDefinition: true, scopeLine: 7, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !12, retainedNodes: !27) 113!27 = !{!28, !29} 114!28 = !DILocalVariable(name: "a", arg: 1, scope: !26, file: !2, line: 7, type: !3) 115!29 = !DILocalVariable(name: "b", scope: !30, file: !2, line: 7, type: !3) 116!30 = distinct !DILexicalBlock(scope: !26, file: !2, line: 7) 117!31 = !DILocation(line: 7, scope: !26) 118!32 = !DILocation(line: 7, scope: !30) 119!33 = distinct !DISubprogram(name: "get3", linkageName: "get3", scope: !2, file: !2, line: 10, type: !17, isLocal: false, isDefinition: true, scopeLine: 10, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !12, retainedNodes: !34) 120!34 = !{!35, !36} 121!35 = !DILocalVariable(name: "a", arg: 1, scope: !33, file: !2, line: 10, type: !3) 122!36 = !DILocalVariable(name: "b", scope: !37, file: !2, line: 10, type: !3) 123!37 = distinct !DILexicalBlock(scope: !33, file: !2, line: 10) 124!38 = !DILocation(line: 10, scope: !33) 125!39 = !DILocation(line: 10, scope: !37) 126!40 = distinct !DISubprogram(name: "get4", linkageName: "get4", scope: !2, file: !2, line: 13, type: !17, isLocal: false, isDefinition: true, scopeLine: 13, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !12, retainedNodes: !41) 127!41 = !{!42, !43} 128!42 = !DILocalVariable(name: "a", arg: 1, scope: !40, file: !2, line: 13, type: !3) 129!43 = !DILocalVariable(name: "b", scope: !44, file: !2, line: 13, type: !3) 130!44 = distinct !DILexicalBlock(scope: !40, file: !2, line: 13) 131!45 = !DILocation(line: 13, scope: !40) 132!46 = !DILocation(line: 13, scope: !44) 133!47 = distinct !DISubprogram(name: "get5", linkageName: "get5", scope: !2, file: !2, line: 16, type: !17, isLocal: false, isDefinition: true, scopeLine: 16, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !12, retainedNodes: !48) 134!48 = !{!49, !50} 135!49 = !DILocalVariable(name: "a", arg: 1, scope: !47, file: !2, line: 16, type: !3) 136!50 = !DILocalVariable(name: "b", scope: !51, file: !2, line: 16, type: !3) 137!51 = distinct !DILexicalBlock(scope: !47, file: !2, line: 16) 138!52 = !DILocation(line: 16, scope: !47) 139!53 = !DILocation(line: 16, scope: !51) 140 141