1; RUN: llc -generate-arange-section < %s | FileCheck %s
2
3; CHECK: .short  2 # DWARF Arange version number
4; CHECK: # Segment Size
5; CHECK-NOT: debug_loc
6; CHECK: .quad global
7; CHECK-NOT: debug_loc
8; CHECK: # ARange terminator
9
10; --- Source code ---
11; Generated with "clang -g -O1 -S -emit-llvm"
12
13; int global = 2;
14; int foo(int bar) { return bar; }
15; int foo2(int bar2) { return bar2; }
16
17; int main() {
18;   return foo(2) + foo2(1) + global;
19; }
20
21; ModuleID = 'tmp/debug_ranges/a.cc'
22source_filename = "test/DebugInfo/X86/dwarf-aranges-no-dwarf-labels.ll"
23target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
24target triple = "x86_64-unknown-linux-gnu"
25
26@global = global i32 2, align 4, !dbg !0
27
28; Function Attrs: nounwind readnone uwtable
29define i32 @_Z3fooi(i32 %bar) #0 !dbg !9 {
30entry:
31  tail call void @llvm.dbg.value(metadata i32 %bar, metadata !13, metadata !14), !dbg !15
32  ret i32 %bar, !dbg !15
33}
34
35; Function Attrs: nounwind readnone uwtable
36define i32 @_Z4foo2i(i32 %bar2) #0 !dbg !16 {
37entry:
38  tail call void @llvm.dbg.value(metadata i32 %bar2, metadata !18, metadata !14), !dbg !19
39  ret i32 %bar2, !dbg !19
40}
41
42; Function Attrs: nounwind readonly uwtable
43define i32 @main() #1 !dbg !20 {
44entry:
45  %call = tail call i32 @_Z3fooi(i32 2), !dbg !23
46  %call1 = tail call i32 @_Z4foo2i(i32 1), !dbg !23
47  %add = add nsw i32 %call1, %call, !dbg !23
48  %0 = load i32, i32* @global, align 4, !dbg !23, !tbaa !24
49  %add2 = add nsw i32 %add, %0, !dbg !23
50  ret i32 %add2, !dbg !23
51}
52
53; Function Attrs: nounwind readnone
54declare void @llvm.dbg.value(metadata, metadata, metadata) #2
55
56attributes #0 = { nounwind readnone uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
57attributes #1 = { nounwind readonly uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
58attributes #2 = { nounwind readnone }
59
60!llvm.dbg.cu = !{!4}
61!llvm.module.flags = !{!7, !8}
62
63!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
64!1 = !DIGlobalVariable(name: "global", scope: null, file: !2, line: 1, type: !3, isLocal: false, isDefinition: true)
65!2 = !DIFile(filename: "tmp/debug_ranges/a.cc", directory: "/")
66!3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
67!4 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, producer: "clang version 3.4 (191881)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !6, imports: !5)
68!5 = !{}
69!6 = !{!0}
70!7 = !{i32 2, !"Dwarf Version", i32 4}
71!8 = !{i32 1, !"Debug Info Version", i32 3}
72!9 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !2, file: !2, line: 2, type: !10, isLocal: false, isDefinition: true, scopeLine: 2, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !4, retainedNodes: !12)
73!10 = !DISubroutineType(types: !11)
74!11 = !{!3, !3}
75!12 = !{!13}
76!13 = !DILocalVariable(name: "bar", arg: 1, scope: !9, file: !2, line: 2, type: !3)
77!14 = !DIExpression()
78!15 = !DILocation(line: 2, scope: !9)
79!16 = distinct !DISubprogram(name: "foo2", linkageName: "_Z4foo2i", scope: !2, file: !2, line: 3, type: !10, isLocal: false, isDefinition: true, scopeLine: 3, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !4, retainedNodes: !17)
80!17 = !{!18}
81!18 = !DILocalVariable(name: "bar2", arg: 1, scope: !16, file: !2, line: 3, type: !3)
82!19 = !DILocation(line: 3, scope: !16)
83!20 = distinct !DISubprogram(name: "main", scope: !2, file: !2, line: 5, type: !21, isLocal: false, isDefinition: true, scopeLine: 5, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !4, retainedNodes: !5)
84!21 = !DISubroutineType(types: !22)
85!22 = !{!3}
86!23 = !DILocation(line: 6, scope: !20)
87!24 = !{!25, !25, i64 0}
88!25 = !{!"int", !26}
89!26 = !{!"omnipotent char", !27}
90!27 = !{!"Simple C/C++ TBAA"}
91
92