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