| 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 -split-dwarf-file=foo.dwo -O0 %t.ll -function-sections -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t |
| 6 |
; RUN: llvm-dwarfdump -debug-abbrev %t | FileCheck --check-prefix=FUNCTION-SECTIONS %s |
| 7 |
; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=FUNCTION-SECTIONS-RELOCS %s |
| 8 |
|
| 9 |
; RUN: llc -split-dwarf-file=foo.dwo -O0 %t.ll -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t |
| 10 |
; RUN: llvm-dwarfdump -debug-abbrev %t | FileCheck --check-prefix=NO-FUNCTION-SECTIONS %s |
| 11 |
|
| 12 |
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64" |
| 13 |
target triple = "spir64-unknown-unknown" |
| 14 |
|
| 15 |
; From: |
| 16 |
; int foo (int a) { |
| 17 |
; return a+1; |
| 18 |
; } |
| 19 |
; int bar (int b) { |
| 20 |
; return b+2; |
| 21 |
; } |
| 22 |
|
| 23 |
; With function sections enabled make sure that we have a DW_AT_ranges attribute. |
| 24 |
; FUNCTION-SECTIONS: DW_AT_ranges |
| 25 |
|
| 26 |
; Check that we have a relocation against the .debug_ranges section. |
| 27 |
; FUNCTION-SECTIONS-RELOCS: R_X86_64_32 .debug_ranges 0x0 |
| 28 |
|
| 29 |
; Without function sections enabled make sure that we have no DW_AT_ranges attribute. |
| 30 |
; NO-FUNCTION-SECTIONS-NOT: DW_AT_ranges |
| 31 |
; NO-FUNCTION-SECTIONS: DW_AT_low_pc DW_FORM_addr |
| 32 |
; NO-FUNCTION-SECTIONS-NOT: DW_AT_ranges |
| 33 |
|
| 34 |
; Function Attrs: nounwind uwtable |
| 35 |
define i32 @foo(i32 %a) #0 !dbg !4 { |
| 36 |
entry: |
| 37 |
%a.addr = alloca i32, align 4 |
| 38 |
store i32 %a, i32* %a.addr, align 4 |
| 39 |
call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !13, metadata !DIExpression()), !dbg !14 |
| 40 |
%0 = load i32, i32* %a.addr, align 4, !dbg !14 |
| 41 |
%add = add nsw i32 %0, 1, !dbg !14 |
| 42 |
ret i32 %add, !dbg !14 |
| 43 |
} |
| 44 |
|
| 45 |
; Function Attrs: nounwind readnone |
| 46 |
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
| 47 |
|
| 48 |
; Function Attrs: nounwind uwtable |
| 49 |
define i32 @bar(i32 %b) #0 !dbg !9 { |
| 50 |
entry: |
| 51 |
%b.addr = alloca i32, align 4 |
| 52 |
store i32 %b, i32* %b.addr, align 4 |
| 53 |
call void @llvm.dbg.declare(metadata i32* %b.addr, metadata !15, metadata !DIExpression()), !dbg !16 |
| 54 |
%0 = load i32, i32* %b.addr, align 4, !dbg !16 |
| 55 |
%add = add nsw i32 %0, 2, !dbg !16 |
| 56 |
ret i32 %add, !dbg !16 |
| 57 |
} |
| 58 |
|
| 59 |
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 60 |
attributes #1 = { nounwind readnone } |
| 61 |
|
| 62 |
!llvm.dbg.cu = !{!0} |
| 63 |
!llvm.module.flags = !{!10, !11} |
| 64 |
!llvm.ident = !{!12} |
| 65 |
|
| 66 |
!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2) |
| 67 |
!1 = !DIFile(filename: "z.c", directory: "/usr/local/google/home/echristo") |
| 68 |
!2 = !{} |
| 69 |
!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !2) |
| 70 |
!5 = !DIFile(filename: "z.c", directory: "/usr/local/google/home/echristo") |
| 71 |
!6 = !DISubroutineType(types: !7) |
| 72 |
!7 = !{!8, !8} |
| 73 |
!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 74 |
!9 = distinct !DISubprogram(name: "bar", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 2, file: !1, scope: !5, type: !6, retainedNodes: !2) |
| 75 |
!10 = !{i32 2, !"Dwarf Version", i32 4} |
| 76 |
!11 = !{i32 1, !"Debug Info Version", i32 3} |
| 77 |
!12 = !{!"clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)"} |
| 78 |
!13 = !DILocalVariable(name: "a", line: 1, arg: 1, scope: !4, file: !5, type: !8) |
| 79 |
!14 = !DILocation(line: 1, scope: !4) |
| 80 |
!15 = !DILocalVariable(name: "b", line: 2, arg: 1, scope: !9, file: !5, type: !8) |
| 81 |
!16 = !DILocation(line: 2, scope: !9) |