Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/DebugInfoChecksum.ll

raw
1 ; Test checks debug info of Checksumkind & Checksum is preserved from LLVM IR to
2 ; SPIR-V and SPIR-V 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 -S -emit-llvm -triple spir -gcodeview -gcodeview-ghash main.cpp
12
13 ; RUN: llvm-as %s -o %t.bc
14 ; RUN: llvm-spirv %t.bc -spirv-text -o - | FileCheck %s --check-prefix CHECK-SPIRV-OCL
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 ; RUN: llvm-spirv %t.bc -spirv-text --spirv-debug-info-version=nonsemantic-shader-200 -o - | FileCheck %s --check-prefix CHECK-SPIRV-200
21 ; RUN: llvm-spirv %t.bc --spirv-debug-info-version=nonsemantic-shader-200 -o %t.spv
22 ; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
23 ; RUN: llvm-dis %t.rev.bc -o %t.rev.ll
24 ; RUN: FileCheck %s --input-file %t.rev.ll --check-prefix CHECK-LLVM
25
26 ; ModuleID = 'source.bc'
27 source_filename = "main.cpp"
28 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"
29 target triple = "spir"
30
31 ; Function Attrs: noinline norecurse nounwind optnone
32 define i32 @main() #0 !dbg !10 {
33 entry:
34 %retval = alloca i32, align 4
35 store i32 0, i32* %retval, align 4
36 ret i32 0, !dbg !15
37 }
38
39 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" }
40
41 !llvm.dbg.cu = !{!0}
42 !llvm.module.flags = !{!3, !4, !5, !6, !7, !8}
43 !opencl.used.extensions = !{!2}
44 !opencl.used.optional.core.features = !{!2}
45 !opencl.compiler.options = !{!2}
46 !llvm.ident = !{!9}
47
48 ; CHECK-LLVM: !DIFile(filename: "main.cpp"
49 ; CHECK-LLVM-SAME: checksumkind: CSK_MD5, checksum: "7bb56387968a9caa6e9e35fff94eaf7b"
50
51 ; CHECK-SPIRV-OCL: String [[#REG:]] "//__CSK_MD5:7bb56387968a9caa6e9e35fff94eaf7b"
52 ; CHECK-SPIRV-OCL: DebugSource [[#]] [[#REG]]
53
54 ; 0 means MD5
55 ; CHECK-SPIRV-200: String [[#Val:]] "7bb56387968a9caa6e9e35fff94eaf7b"
56 ; CHECK-SPIRV-200: TypeInt [[#TypeInt32:]] 32
57 ; CHECK-SPIRV-200: Constant [[#TypeInt32]] [[#Kind:]] 0
58 ; CHECK-SPIRV-200: DebugSource [[#]] [[#Kind]] [[#Val]]
59
60 !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 7d09e1d7cf27ce781e83f9d388a7a3e1e6487ead)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
61 !1 = !DIFile(filename: "<stdin>", directory: "oneAPI", checksumkind: CSK_MD5, checksum: "7bb56387968a9caa6e9e35fff94eaf7b")
62 !2 = !{}
63 !3 = !{i32 2, !"CodeView", i32 1}
64 !4 = !{i32 2, !"CodeViewGHash", i32 1}
65 !5 = !{i32 2, !"Debug Info Version", i32 3}
66 !6 = !{i32 1, !"wchar_size", i32 4}
67 !7 = !{i32 1, !"ThinLTO", i32 0}
68 !8 = !{i32 1, !"EnableSplitLTOUnit", i32 1}
69 !9 = !{!"clang version 13.0.0 (https://github.com/llvm/llvm-project.git 7d09e1d7cf27ce781e83f9d388a7a3e1e6487ead)"}
70 !10 = distinct !DISubprogram(name: "main", scope: !11, file: !11, line: 1, type: !12, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
71 !11 = !DIFile(filename: "main.cpp", directory: "C:\\", checksumkind: CSK_MD5, checksum: "7bb56387968a9caa6e9e35fff94eaf7b")
72 !12 = !DISubroutineType(types: !13)
73 !13 = !{!14}
74 !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
75 !15 = !DILocation(line: 2, column: 3, scope: !10)