Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/mangled_function.ll

raw
1 ; Make sure translator doesn't crash if the program contains
2 ; a mangled function which is not an OpenCL bultin.
3 ; Source:
4 ; void __attribute__((overloadable))
5 ; foo(image2d_t srcImage);
6 ;
7 ; void bar(image2d_t srcImage) {
8 ; foo(srcImage);
9 ; }
10 ; clang -cc1 /work/tmp/tmp.cl -cl-std=CL2.0 -triple spir-unknown-unknown -finclude-default-header -emit-llvm -o test/mangled_function.ll
11
12 ; RUN: llvm-as < %s | llvm-spirv -o %t.spv
13 ; RUN: spirv-val %t.spv
14 ; RUN: llvm-spirv %t.spv -o - -to-text | FileCheck %s --check-prefix=CHECK-SPIRV
15 ; RUN: llvm-spirv %t.spv -o - -r -emit-opaque-pointers | llvm-dis | FileCheck %s --check-prefix=CHECK-LLVM
16
17 ; CHECK-SPIRV: Name [[foo:[0-9]+]] "_Z3foo14ocl_image2d_ro"
18 ; CHECK-SPIRV: Function {{[0-9]+}} [[foo]]
19
20 ; ModuleID = '/work/tmp/tmp.cl'
21 source_filename = "/work/tmp/tmp.cl"
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"
23 target triple = "spir-unknown-unknown"
24
25 %opencl.image2d_ro_t = type opaque
26
27 ; Function Attrs: convergent nounwind
28 define spir_func void @bar(%opencl.image2d_ro_t addrspace(1)* %srcImage) local_unnamed_addr #0 {
29 entry:
30 ; CHECK-LLVM: call spir_func void @_Z3foo14ocl_image2d_ro(ptr addrspace(1) %srcImage)
31 tail call spir_func void @_Z3foo14ocl_image2d_ro(%opencl.image2d_ro_t addrspace(1)* %srcImage) #2
32 ret void
33 }
34
35 ; Function Attrs: convergent
36 declare spir_func void @_Z3foo14ocl_image2d_ro(%opencl.image2d_ro_t addrspace(1)*) local_unnamed_addr #1
37
38 attributes #0 = { convergent nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "denorms-are-zero"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
39 attributes #1 = { convergent "correctly-rounded-divide-sqrt-fp-math"="false" "denorms-are-zero"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
40 attributes #2 = { convergent nounwind }
41
42 !llvm.module.flags = !{!0}
43 !opencl.ocl.version = !{!1}
44 !opencl.spir.version = !{!1}
45 !llvm.ident = !{!2}
46
47 !0 = !{i32 1, !"wchar_size", i32 4}
48 !1 = !{i32 2, i32 0}
49 !2 = !{!"clang version 9.0.0 (https://llvm.org/git/clang d81772e8081d5af6925826ebf18ade9dd0323bb9) (https://llvm.org/git/llvm 5a295517ec57c58837c5fe5cf364c0f2e609865f)"}