| 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 -filetype=obj -o %t.o %t.ll |
| 6 |
; RUN: llvm-dwarfdump -v %t.o | FileCheck %s |
| 7 |
|
| 8 |
; Testcase generated using 'clang -g -O2 -S -emit-llvm' from the following: |
| 9 |
;; void sink(void); |
| 10 |
;; static __attribute__((always_inline)) void bar(int a) { sink(); } |
| 11 |
;; void foo(void) { |
| 12 |
;; bar(0); |
| 13 |
;; bar(0); |
| 14 |
;; } |
| 15 |
|
| 16 |
; Check that we have formal parameters for 'a' in both inlined subroutines. |
| 17 |
; CHECK: .debug_info |
| 18 |
; CHECK: DW_TAG_inlined_subroutine |
| 19 |
; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "bar" |
| 20 |
; CHECK: DW_TAG_formal_parameter |
| 21 |
; CHECK-NEXT: DW_AT_const_value |
| 22 |
; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "a" |
| 23 |
; CHECK: DW_TAG_inlined_subroutine |
| 24 |
; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "bar" |
| 25 |
; CHECK: DW_TAG_formal_parameter |
| 26 |
; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata] (0) |
| 27 |
; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "a" |
| 28 |
|
| 29 |
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
| 30 |
target triple = "spir64-unknown-unknown" |
| 31 |
|
| 32 |
; Function Attrs: nounwind ssp uwtable |
| 33 |
define void @foo() #0 !dbg !4 { |
| 34 |
entry: |
| 35 |
tail call void @llvm.dbg.value(metadata i32 0, metadata !12, metadata !17) #3, !dbg !18 |
| 36 |
tail call void @sink() #3, !dbg !20 |
| 37 |
tail call void @llvm.dbg.value(metadata i32 0, metadata !12, metadata !17) #3, !dbg !21 |
| 38 |
tail call void @sink() #3, !dbg !23 |
| 39 |
ret void, !dbg !24 |
| 40 |
} |
| 41 |
|
| 42 |
declare void @sink() |
| 43 |
|
| 44 |
; Function Attrs: nounwind readnone |
| 45 |
declare void @llvm.dbg.value(metadata, metadata, metadata) #2 |
| 46 |
|
| 47 |
attributes #0 = { nounwind ssp uwtable } |
| 48 |
attributes #2 = { nounwind readnone } |
| 49 |
attributes #3 = { nounwind } |
| 50 |
|
| 51 |
!llvm.dbg.cu = !{!0} |
| 52 |
!llvm.module.flags = !{!13, !14, !15} |
| 53 |
!llvm.ident = !{!16} |
| 54 |
|
| 55 |
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 235110) (llvm/trunk 235108)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2) |
| 56 |
!1 = !DIFile(filename: "t.c", directory: "/path/to/dir") |
| 57 |
!2 = !{} |
| 58 |
!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2) |
| 59 |
!5 = !DISubroutineType(types: !6) |
| 60 |
!6 = !{null} |
| 61 |
!7 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 2, type: !8, isLocal: true, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !11) |
| 62 |
!8 = !DISubroutineType(types: !9) |
| 63 |
!9 = !{null, !10} |
| 64 |
!10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 65 |
!11 = !{!12} |
| 66 |
!12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10) |
| 67 |
!13 = !{i32 2, !"Dwarf Version", i32 2} |
| 68 |
!14 = !{i32 2, !"Debug Info Version", i32 3} |
| 69 |
!15 = !{i32 1, !"PIC Level", i32 2} |
| 70 |
!16 = !{!"clang version 3.7.0 (trunk 235110) (llvm/trunk 235108)"} |
| 71 |
!17 = !DIExpression() |
| 72 |
!18 = !DILocation(line: 2, column: 52, scope: !7, inlinedAt: !19) |
| 73 |
!19 = distinct !DILocation(line: 4, column: 3, scope: !4) |
| 74 |
!20 = !DILocation(line: 2, column: 57, scope: !7, inlinedAt: !19) |
| 75 |
!21 = !DILocation(line: 2, column: 52, scope: !7, inlinedAt: !22) |
| 76 |
!22 = distinct !DILocation(line: 5, column: 3, scope: !4) |
| 77 |
!23 = !DILocation(line: 2, column: 57, scope: !7, inlinedAt: !22) |
| 78 |
!24 = !DILocation(line: 6, column: 1, scope: !4) |