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' 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 27 28; Function Attrs: nounwind readnone uwtable 29define i32 @_Z3fooi(i32 %bar) #0 !dbg !4 { 30entry: 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 36define i32 @_Z4foo2i(i32 %bar2) #0 !dbg !11 { 37entry: 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 43define i32 @main() #1 !dbg !14 { 44entry: 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 54declare void @llvm.dbg.value(metadata, i64, 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 = !{!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: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !17, imports: !2) 64!1 = !DIFile(filename: "tmp/debug_ranges/a.cc", directory: "/") 65!2 = !{} 66!3 = !{!4, !11, !14} 67!4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 2, file: !1, scope: !5, type: !6, variables: !9) 68!5 = !DIFile(filename: "tmp/debug_ranges/a.cc", directory: "/") 69!6 = !DISubroutineType(types: !7) 70!7 = !{!8, !8} 71!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 72!9 = !{!10} 73!10 = !DILocalVariable(name: "bar", line: 2, arg: 1, scope: !4, file: !5, type: !8) 74!11 = distinct !DISubprogram(name: "foo2", linkageName: "_Z4foo2i", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 3, file: !1, scope: !5, type: !6, variables: !12) 75!12 = !{!13} 76!13 = !DILocalVariable(name: "bar2", line: 3, arg: 1, scope: !11, file: !5, type: !8) 77!14 = distinct !DISubprogram(name: "main", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 5, file: !1, scope: !5, type: !15, variables: !2) 78!15 = !DISubroutineType(types: !16) 79!16 = !{!8} 80!17 = !{!18} 81!18 = !DIGlobalVariable(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 = !DILocation(line: 2, scope: !4) 84!21 = !DILocation(line: 3, scope: !11) 85!22 = !DILocation(line: 6, scope: !14) 86!23 = !{!"int", !24} 87!24 = !{!"omnipotent char", !25} 88!25 = !{!"Simple C/C++ TBAA"} 89!26 = !{i32 1, !"Debug Info Version", i32 3} 90