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