1 ; RUN: llc -generate-arange-section < %s | FileCheck %s
3 ; CHECK: .short 2 # DWARF Arange version number
4 ; CHECK: # Segment Size
8 ; CHECK: # ARange terminator
11 ; Generated with "clang -g -O1 -S -emit-llvm"
14 ; int foo(int bar) { return bar; }
15 ; int foo2(int bar2) { return bar2; }
18 ; return foo(2) + foo2(1) + global;
22 ; ModuleID = 'tmp/debug_ranges/a.cc'
23 target 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"
24 target triple = "x86_64-unknown-linux-gnu"
26 @global = global i32 2, align 4
28 ; Function Attrs: nounwind readnone uwtable
29 define i32 @_Z3fooi(i32 %bar) #0 {
31 tail call void @llvm.dbg.value(metadata i32 %bar, i64 0, metadata !10, metadata !MDExpression()), !dbg !20
32 ret i32 %bar, !dbg !20
35 ; Function Attrs: nounwind readnone uwtable
36 define i32 @_Z4foo2i(i32 %bar2) #0 {
38 tail call void @llvm.dbg.value(metadata i32 %bar2, i64 0, metadata !13, metadata !MDExpression()), !dbg !21
39 ret i32 %bar2, !dbg !21
42 ; Function Attrs: nounwind readonly uwtable
43 define i32 @main() #1 {
45 %call = tail call i32 @_Z3fooi(i32 2), !dbg !22
46 %call1 = tail call i32 @_Z4foo2i(i32 1), !dbg !22
47 %add = add nsw i32 %call1, %call, !dbg !22
48 %0 = load i32, i32* @global, align 4, !dbg !22, !tbaa !23
49 %add2 = add nsw i32 %add, %0, !dbg !22
50 ret i32 %add2, !dbg !22
53 ; Function Attrs: nounwind readnone
54 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
56 attributes #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" }
57 attributes #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" }
58 attributes #2 = { nounwind readnone }
61 !llvm.module.flags = !{!19, !26}
63 !0 = !MDCompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (191881)", isOptimized: true, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !17, imports: !2)
64 !1 = !MDFile(filename: "tmp/debug_ranges/a.cc", directory: "/")
67 !4 = !MDSubprogram(name: "foo", linkageName: "_Z3fooi", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 2, file: !1, scope: !5, type: !6, function: i32 (i32)* @_Z3fooi, variables: !9)
68 !5 = !MDFile(filename: "tmp/debug_ranges/a.cc", directory: "/")
69 !6 = !MDSubroutineType(types: !7)
71 !8 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
73 !10 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "bar", line: 2, arg: 1, scope: !4, file: !5, type: !8)
74 !11 = !MDSubprogram(name: "foo2", linkageName: "_Z4foo2i", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 3, file: !1, scope: !5, type: !6, function: i32 (i32)* @_Z4foo2i, variables: !12)
76 !13 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "bar2", line: 3, arg: 1, scope: !11, file: !5, type: !8)
77 !14 = !MDSubprogram(name: "main", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 5, file: !1, scope: !5, type: !15, function: i32 ()* @main, variables: !2)
78 !15 = !MDSubroutineType(types: !16)
81 !18 = !MDGlobalVariable(name: "global", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8, variable: i32* @global)
82 !19 = !{i32 2, !"Dwarf Version", i32 4}
83 !20 = !MDLocation(line: 2, scope: !4)
84 !21 = !MDLocation(line: 3, scope: !11)
85 !22 = !MDLocation(line: 6, scope: !14)
87 !24 = !{!"omnipotent char", !25}
88 !25 = !{!"Simple C/C++ TBAA"}
89 !26 = !{i32 1, !"Debug Info Version", i32 3}