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 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" 25 26 @global = global i32 2, align 4 27 28 ; Function Attrs: nounwind readnone uwtable 29 define i32 @_Z3fooi(i32 %bar) #0 !dbg !4 { 30 entry: 31 tail call void @llvm.dbg.value(metadata i32 %bar, i64 0, metadata !10, metadata !DIExpression()), !dbg !20 32 ret i32 %bar, !dbg !20 33 } 34 35 ; Function Attrs: nounwind readnone uwtable 36 define i32 @_Z4foo2i(i32 %bar2) #0 !dbg !11 { 37 entry: 38 tail call void @llvm.dbg.value(metadata i32 %bar2, i64 0, metadata !13, metadata !DIExpression()), !dbg !21 39 ret i32 %bar2, !dbg !21 40 } 41 42 ; Function Attrs: nounwind readonly uwtable 43 define i32 @main() #1 !dbg !14 { 44 entry: 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 51 } 52 53 ; Function Attrs: nounwind readnone 54 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2 55 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 } 59 60 !llvm.dbg.cu = !{!0} 61 !llvm.module.flags = !{!19, !26} 62 63 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (191881)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !17, imports: !2) 64 !1 = !DIFile(filename: "tmp/debug_ranges/a.cc", directory: "/") 65 !2 = !{} 66 !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 2, file: !1, scope: !5, type: !6, variables: !9) 67 !5 = !DIFile(filename: "tmp/debug_ranges/a.cc", directory: "/") 68 !6 = !DISubroutineType(types: !7) 69 !7 = !{!8, !8} 70 !8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 71 !9 = !{!10} 72 !10 = !DILocalVariable(name: "bar", line: 2, arg: 1, scope: !4, file: !5, type: !8) 73 !11 = distinct !DISubprogram(name: "foo2", linkageName: "_Z4foo2i", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 3, file: !1, scope: !5, type: !6, variables: !12) 74 !12 = !{!13} 75 !13 = !DILocalVariable(name: "bar2", line: 3, arg: 1, scope: !11, file: !5, type: !8) 76 !14 = distinct !DISubprogram(name: "main", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 5, file: !1, scope: !5, type: !15, variables: !2) 77 !15 = !DISubroutineType(types: !16) 78 !16 = !{!8} 79 !17 = !{!18} 80 !18 = !DIGlobalVariable(name: "global", line: 1, isLocal: false, isDefinition: true, scope: null, file: !5, type: !8, variable: i32* @global) 81 !19 = !{i32 2, !"Dwarf Version", i32 4} 82 !20 = !DILocation(line: 2, scope: !4) 83 !21 = !DILocation(line: 3, scope: !11) 84 !22 = !DILocation(line: 6, scope: !14) 85 !23 = !{!"int", !24} 86 !24 = !{!"omnipotent char", !25} 87 !25 = !{!"Simple C/C++ TBAA"} 88 !26 = !{i32 1, !"Debug Info Version", i32 3} 89