| 1 |
; RUN: llvm-as %s -o %t.bc |
| 2 |
; RUN: llvm-spirv -spirv-text %t.bc -o %t.spt --spirv-debug-info-version=nonsemantic-shader-200 |
| 3 |
; RUN: FileCheck < %t.spt %s -check-prefix=CHECK-SPIRV |
| 4 |
; RUN: llvm-spirv -to-binary %t.spt -o %t.spv |
| 5 |
|
| 6 |
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc |
| 7 |
; RUN: llvm-dis %t.rev.bc -o %t.rev.ll |
| 8 |
; RUN: FileCheck < %t.rev.ll %s -check-prefix=CHECK-LLVM |
| 9 |
|
| 10 |
; CHECK-SPIRV-DAG: ExtInstImport [[#EISId:]] "NonSemantic.Shader.DebugInfo.200" |
| 11 |
; CHECK-SPIRV-DAG: String [[#Func:]] "foo_wrapper" |
| 12 |
; CHECK-SPIRV-DAG: String [[#TargetFunc:]] "_Z3foov" |
| 13 |
|
| 14 |
; CHECK-SPIRV-DAG: TypeInt [[#TyInt32Id:]] 32 0 |
| 15 |
; CHECK-SPIRV-DAG: Constant [[#TyInt32Id]] [[#Constant1Id:]] 1{{[[:space:]]}} |
| 16 |
; CHECK-SPIRV-DAG: Constant [[#TyInt32Id]] [[#Constant2Id:]] 2{{[[:space:]]}} |
| 17 |
; CHECK-SPIRV-DAG: Constant [[#TyInt32Id]] [[#Constant4Id:]] 4{{[[:space:]]}} |
| 18 |
; CHECK-SPIRV-DAG: Constant [[#TyInt32Id]] [[#Constant5Id:]] 5{{[[:space:]]}} |
| 19 |
; CHECK-SPIRV-DAG: Constant [[#TyInt32Id]] [[#Constant6Id:]] 6{{[[:space:]]}} |
| 20 |
; CHECK-SPIRV-DAG: Constant [[#TyInt32Id]] [[#Constant8Id:]] 8{{[[:space:]]}} |
| 21 |
; CHECK-SPIRV-DAG: Constant [[#TyInt32Id]] [[#Constant9Id:]] 9{{[[:space:]]}} |
| 22 |
|
| 23 |
; CHECK-SPIRV-DAG: ExtInst [[#]] [[#DebugNone:]] [[#]] DebugInfoNone |
| 24 |
; CHECK-SPIRV-DAG: ExtInst [[#]] [[#]] [[#]] DebugFunction [[#Func]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#DebugNone]] [[#TargetFunc]] |
| 25 |
|
| 26 |
; CHECK-SPIRV: [[#EISId]] DebugLine [[#]] [[#Constant4Id]] [[#Constant4Id]] [[#Constant5Id]] [[#Constant6Id]] |
| 27 |
; CHECK-SPIRV: [[#EISId]] DebugLine [[#]] [[#Constant5Id]] [[#Constant5Id]] [[#Constant1Id]] [[#Constant2Id]] |
| 28 |
; CHECK-SPIRV: [[#EISId]] DebugLine [[#]] [[#Constant8Id]] [[#Constant8Id]] [[#Constant5Id]] [[#Constant6Id]] |
| 29 |
; CHECK-SPIRV: [[#EISId]] DebugLine [[#]] [[#Constant9Id]] [[#Constant9Id]] [[#Constant1Id]] [[#Constant2Id]] |
| 30 |
|
| 31 |
; CHECK-LLVM: define spir_func void @_Z11foo_wrapperv() {{.*}} !dbg ![[#DbgSubProg:]] { |
| 32 |
; CHECK-LLVM: ![[#Scope_foo_wrapper:]] = distinct !DISubprogram(name: "foo_wrapper", linkageName: "_Z11foo_wrapperv", scope: null, file: ![[#]], line: 3, type: ![[#]], scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: ![[#]], templateParams: ![[#]], retainedNodes: ![[#]], targetFuncName: "_Z3foov") |
| 33 |
; CHECK-LLVM: !DILocation(line: 4, column: 5, scope: ![[#Scope_foo_wrapper]] |
| 34 |
; CHECK-LLVM: !DILocation(line: 5, column: 1, scope: ![[#Scope_foo_wrapper]] |
| 35 |
; CHECK-LLVM: ![[#Scope_boo:]] = distinct !DISubprogram(name: "boo", linkageName: "_Z3boov" |
| 36 |
; CHECK-LLVM: !DILocation(line: 8, column: 5, scope: ![[#Scope_boo]] |
| 37 |
; CHECK-LLVM: !DILocation(line: 9, column: 1, scope: ![[#Scope_boo]] |
| 38 |
|
| 39 |
; ModuleID = 'example.bc' |
| 40 |
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-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024" |
| 41 |
target triple = "spir64-unknown-unknown" |
| 42 |
|
| 43 |
define spir_func void @_Z11foo_wrapperv() !dbg !10 { |
| 44 |
call void @_Z3foov(), !dbg !15 |
| 45 |
ret void, !dbg !16 |
| 46 |
} |
| 47 |
|
| 48 |
declare spir_func void @_Z3foov() |
| 49 |
|
| 50 |
define spir_func void @_Z3boov() !dbg !17 { |
| 51 |
call void @_Z11foo_wrapperv(), !dbg !18 |
| 52 |
ret void, !dbg !19 |
| 53 |
} |
| 54 |
|
| 55 |
!llvm.dbg.cu = !{!0} |
| 56 |
!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8} |
| 57 |
!llvm.ident = !{!9} |
| 58 |
|
| 59 |
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 17.0.0 (https://github.com/llvm/llvm-project.git 88bd2601c013e349fa907b3f878312a94e16e9f6)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) |
| 60 |
!1 = !DIFile(filename: "/app/example.cpp", directory: "/app") |
| 61 |
!2 = !{i32 7, !"Dwarf Version", i32 4} |
| 62 |
!3 = !{i32 2, !"Debug Info Version", i32 3} |
| 63 |
!4 = !{i32 1, !"wchar_size", i32 4} |
| 64 |
!5 = !{i32 8, !"PIC Level", i32 2} |
| 65 |
!6 = !{i32 7, !"PIE Level", i32 2} |
| 66 |
!7 = !{i32 7, !"uwtable", i32 2} |
| 67 |
!8 = !{i32 7, !"frame-pointer", i32 2} |
| 68 |
!9 = !{!"clang version 17.0.0 (https://github.com/llvm/llvm-project.git 88bd2601c013e349fa907b3f878312a94e16e9f6)"} |
| 69 |
!10 = distinct !DISubprogram(name: "foo_wrapper", linkageName: "_Z11foo_wrapperv", scope: !11, file: !11, line: 3, type: !12, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !14, targetFuncName: "_Z3foov") |
| 70 |
!11 = !DIFile(filename: "example.cpp", directory: "/app") |
| 71 |
!12 = !DISubroutineType(types: !13) |
| 72 |
!13 = !{null} |
| 73 |
!14 = !{} |
| 74 |
!15 = !DILocation(line: 4, column: 5, scope: !10) |
| 75 |
!16 = !DILocation(line: 5, column: 1, scope: !10) |
| 76 |
!17 = distinct !DISubprogram(name: "boo", linkageName: "_Z3boov", scope: !11, file: !11, line: 7, type: !12, scopeLine: 7, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !14) |
| 77 |
!18 = !DILocation(line: 8, column: 5, scope: !17) |
| 78 |
!19 = !DILocation(line: 9, column: 1, scope: !17) |