| 1 |
; Test checks debug info of producer is preserved from LLVM IR to spirv |
| 2 |
; and spirv to LLVM IR translation. |
| 3 |
|
| 4 |
; Original .cpp source: |
| 5 |
; |
| 6 |
; int main() { |
| 7 |
; return 0; |
| 8 |
; } |
| 9 |
|
| 10 |
; Command line: |
| 11 |
; ./clang -cc1 -debug-info-kind=standalone -v s.cpp -S -emit-llvm -triple spir |
| 12 |
|
| 13 |
; RUN: llvm-as %s -o %t.bc |
| 14 |
; RUN: llvm-spirv %t.bc -spirv-text -o - | FileCheck %s --check-prefix CHECK-SPIRV |
| 15 |
; RUN: llvm-spirv %t.bc -o %t.spv |
| 16 |
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc |
| 17 |
; RUN: llvm-dis %t.rev.bc -o %t.rev.ll |
| 18 |
; RUN: FileCheck %s --input-file %t.rev.ll --check-prefix CHECK-LLVM |
| 19 |
|
| 20 |
; ModuleID = 's.bc' |
| 21 |
source_filename = "s.cpp" |
| 22 |
target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64" |
| 23 |
target triple = "spir" |
| 24 |
|
| 25 |
; Function Attrs: noinline norecurse nounwind optnone |
| 26 |
define i32 @main() #0 !dbg !8 { |
| 27 |
entry: |
| 28 |
%retval = alloca i32, align 4 |
| 29 |
store i32 0, i32* %retval, align 4 |
| 30 |
ret i32 0, !dbg !13 |
| 31 |
} |
| 32 |
|
| 33 |
attributes #0 = { noinline norecurse nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 34 |
|
| 35 |
!llvm.dbg.cu = !{!0} |
| 36 |
!llvm.module.flags = !{!3, !4, !5, !6} |
| 37 |
!opencl.used.extensions = !{!2} |
| 38 |
!opencl.used.optional.core.features = !{!2} |
| 39 |
!opencl.compiler.options = !{!2} |
| 40 |
!llvm.ident = !{!7} |
| 41 |
|
| 42 |
; CHECK-LLVM: !DICompileUnit |
| 43 |
; CHECK-LLVM-SAME: producer: "clang version 13.0.0 (https://github.com/llvm/llvm-project.git 16a50c9e642fd085e5ceb68c403b71b5b2e0607c)" |
| 44 |
; CHECK-LLVM-NOT: producer: "spirv" |
| 45 |
; CHECK-SPIRV: ModuleProcessed "Debug info producer: clang version 13.0.0 (https://github.com/llvm/llvm-project.git 16a50c9e642fd085e5ceb68c403b71b5b2e0607c)" |
| 46 |
; CHECK-SPIRV-NOT: DebugBuildIdentifier |
| 47 |
; CHECK-SPIRV-NOT: DebugStoragePath |
| 48 |
|
| 49 |
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 13.0.0 (https://github.com/llvm/llvm-project.git 16a50c9e642fd085e5ceb68c403b71b5b2e0607c)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None) |
| 50 |
!1 = !DIFile(filename: "<stdin>", directory: "oneAPI") |
| 51 |
!2 = !{} |
| 52 |
!3 = !{i32 2, !"Debug Info Version", i32 3} |
| 53 |
!4 = !{i32 1, !"wchar_size", i32 4} |
| 54 |
!5 = !{i32 1, !"ThinLTO", i32 0} |
| 55 |
!6 = !{i32 1, !"EnableSplitLTOUnit", i32 1} |
| 56 |
!7 = !{!"clang version 13.0.0 (https://github.com/llvm/llvm-project.git 16a50c9e642fd085e5ceb68c403b71b5b2e0607c)"} |
| 57 |
!8 = distinct !DISubprogram(name: "main", scope: !9, file: !9, line: 1, type: !10, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) |
| 58 |
!9 = !DIFile(filename: "s.cpp", directory: "C:\\") |
| 59 |
!10 = !DISubroutineType(types: !11) |
| 60 |
!11 = !{!12} |
| 61 |
!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 62 |
!13 = !DILocation(line: 2, column: 2, scope: !8) |