|
| 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: llvm-spirv %t.spv -o - -to-text | FileCheck %s --check-prefix=CHECK-SPIRV |
| 14 | +; RUN: llvm-spirv %t.spv -o - -r | llvm-dis | FileCheck %s --check-prefix=CHECK-LLVM |
| 15 | + |
| 16 | +; CHECK-SPIRV: Name [[foo:[0-9]+]] "_Z3foo14ocl_image2d_ro" |
| 17 | +; CHECK-SPIRV: Function {{[0-9]+}} [[foo]] |
| 18 | + |
| 19 | +; ModuleID = '/work/tmp/tmp.cl' |
| 20 | +source_filename = "/work/tmp/tmp.cl" |
| 21 | +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" |
| 22 | +target triple = "spir-unknown-unknown" |
| 23 | + |
| 24 | +%opencl.image2d_ro_t = type opaque |
| 25 | + |
| 26 | +; Function Attrs: convergent nounwind |
| 27 | +define spir_func void @bar(%opencl.image2d_ro_t addrspace(1)* %srcImage) local_unnamed_addr #0 { |
| 28 | +entry: |
| 29 | +; CHECK-LLVM: call spir_func void @_Z3foo14ocl_image2d_ro(%opencl.image2d_ro_t addrspace(1)* %srcImage) |
| 30 | + tail call spir_func void @_Z3foo14ocl_image2d_ro(%opencl.image2d_ro_t addrspace(1)* %srcImage) #2 |
| 31 | + ret void |
| 32 | +} |
| 33 | + |
| 34 | +; Function Attrs: convergent |
| 35 | +declare spir_func void @_Z3foo14ocl_image2d_ro(%opencl.image2d_ro_t addrspace(1)*) local_unnamed_addr #1 |
| 36 | + |
| 37 | +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" } |
| 38 | +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" } |
| 39 | +attributes #2 = { convergent nounwind } |
| 40 | + |
| 41 | +!llvm.module.flags = !{!0} |
| 42 | +!opencl.ocl.version = !{!1} |
| 43 | +!opencl.spir.version = !{!1} |
| 44 | +!llvm.ident = !{!2} |
| 45 | + |
| 46 | +!0 = !{i32 1, !"wchar_size", i32 4} |
| 47 | +!1 = !{i32 2, i32 0} |
| 48 | +!2 = !{!"clang version 9.0.0 (https://llvm.org/git/clang d81772e8081d5af6925826ebf18ade9dd0323bb9) (https://llvm.org/git/llvm 5a295517ec57c58837c5fe5cf364c0f2e609865f)"} |
0 commit comments