| 1 |
; RUN: llvm-as < %s -o %t.bc |
| 2 |
; RUN: llvm-spirv %t.bc -o %t.spv |
| 3 |
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll |
| 4 |
|
| 5 |
; RUN: llc -mtriple=%triple -generate-arange-section < %t.ll | FileCheck %s |
| 6 |
|
| 7 |
; CHECK: .short 2 # DWARF Arange version number |
| 8 |
; CHECK: # Segment Size |
| 9 |
; CHECK-NOT: debug_loc |
| 10 |
; CHECK: .quad global |
| 11 |
; CHECK-NOT: debug_loc |
| 12 |
; CHECK: # ARange terminator |
| 13 |
|
| 14 |
; --- Source code --- |
| 15 |
; Generated with "clang -g -O1 -S -emit-llvm" |
| 16 |
|
| 17 |
; int global = 2; |
| 18 |
; int foo(int bar) { return bar; } |
| 19 |
; int foo2(int bar2) { return bar2; } |
| 20 |
|
| 21 |
; int main() { |
| 22 |
; return foo(2) + foo2(1) + global; |
| 23 |
; } |
| 24 |
|
| 25 |
; ModuleID = 'tmp/debug_ranges/a.cc' |
| 26 |
source_filename = "test/DebugInfo/X86/dwarf-aranges-no-dwarf-labels.ll" |
| 27 |
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" |
| 28 |
target triple = "spir64-unknown-unknown" |
| 29 |
|
| 30 |
@global = global i32 2, align 4, !dbg !0 |
| 31 |
|
| 32 |
; Function Attrs: nounwind readnone uwtable |
| 33 |
define i32 @_Z3fooi(i32 %bar) #0 !dbg !9 { |
| 34 |
entry: |
| 35 |
tail call void @llvm.dbg.value(metadata i32 %bar, metadata !13, metadata !14), !dbg !15 |
| 36 |
ret i32 %bar, !dbg !15 |
| 37 |
} |
| 38 |
|
| 39 |
; Function Attrs: nounwind readnone uwtable |
| 40 |
define i32 @_Z4foo2i(i32 %bar2) #0 !dbg !16 { |
| 41 |
entry: |
| 42 |
tail call void @llvm.dbg.value(metadata i32 %bar2, metadata !18, metadata !14), !dbg !19 |
| 43 |
ret i32 %bar2, !dbg !19 |
| 44 |
} |
| 45 |
|
| 46 |
; Function Attrs: nounwind readonly uwtable |
| 47 |
define i32 @main() #1 !dbg !20 { |
| 48 |
entry: |
| 49 |
%call = tail call i32 @_Z3fooi(i32 2), !dbg !23 |
| 50 |
%call1 = tail call i32 @_Z4foo2i(i32 1), !dbg !23 |
| 51 |
%add = add nsw i32 %call1, %call, !dbg !23 |
| 52 |
%0 = load i32, i32* @global, align 4, !dbg !23, !tbaa !24 |
| 53 |
%add2 = add nsw i32 %add, %0, !dbg !23 |
| 54 |
ret i32 %add2, !dbg !23 |
| 55 |
} |
| 56 |
|
| 57 |
; Function Attrs: nounwind readnone |
| 58 |
declare void @llvm.dbg.value(metadata, metadata, metadata) #2 |
| 59 |
|
| 60 |
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" } |
| 61 |
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" } |
| 62 |
attributes #2 = { nounwind readnone } |
| 63 |
|
| 64 |
!llvm.dbg.cu = !{!4} |
| 65 |
!llvm.module.flags = !{!7, !8} |
| 66 |
|
| 67 |
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) |
| 68 |
!1 = !DIGlobalVariable(name: "global", scope: null, file: !2, line: 1, type: !3, isLocal: false, isDefinition: true) |
| 69 |
!2 = !DIFile(filename: "tmp/debug_ranges/a.cc", directory: "/") |
| 70 |
!3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 71 |
!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) |
| 72 |
!5 = !{} |
| 73 |
!6 = !{!0} |
| 74 |
!7 = !{i32 2, !"Dwarf Version", i32 4} |
| 75 |
!8 = !{i32 1, !"Debug Info Version", i32 3} |
| 76 |
!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) |
| 77 |
!10 = !DISubroutineType(types: !11) |
| 78 |
!11 = !{!3, !3} |
| 79 |
!12 = !{!13} |
| 80 |
!13 = !DILocalVariable(name: "bar", arg: 1, scope: !9, file: !2, line: 2, type: !3) |
| 81 |
!14 = !DIExpression() |
| 82 |
!15 = !DILocation(line: 2, scope: !9) |
| 83 |
!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) |
| 84 |
!17 = !{!18} |
| 85 |
!18 = !DILocalVariable(name: "bar2", arg: 1, scope: !16, file: !2, line: 3, type: !3) |
| 86 |
!19 = !DILocation(line: 3, scope: !16) |
| 87 |
!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) |
| 88 |
!21 = !DISubroutineType(types: !22) |
| 89 |
!22 = !{!3} |
| 90 |
!23 = !DILocation(line: 6, scope: !20) |
| 91 |
!24 = !{!25, !25, i64 0} |
| 92 |
!25 = !{!"int", !26} |
| 93 |
!26 = !{!"omnipotent char", !27} |
| 94 |
!27 = !{!"Simple C/C++ TBAA"} |
| 95 |
|