252
|
1 // RUN: %clang_cc1 -fsycl-is-device -emit-llvm -triple spir64 -verify -emit-llvm %s -o - | FileCheck %s
|
236
|
2
|
|
3 // expected-no-diagnostics
|
|
4
|
|
5 template <typename Name, typename Func>
|
|
6 __attribute__((sycl_kernel)) void kernel_single_task(const Func &kernelFunc) {
|
|
7 kernelFunc();
|
|
8 }
|
|
9
|
252
|
10 // CHECK: define dso_local spir_func{{.*}}invoke_function{{.*}}(ptr noundef %fptr, ptr addrspace(4) noundef %ptr)
|
236
|
11 void invoke_function(int (*fptr)(), int *ptr) {}
|
|
12
|
|
13 int f() { return 0; }
|
|
14
|
|
15 int main() {
|
|
16 kernel_single_task<class fake_kernel>([=]() {
|
|
17 int (*p)() = f;
|
|
18 int (&r)() = *p;
|
|
19 int a = 10;
|
|
20 invoke_function(p, &a);
|
|
21 invoke_function(r, &a);
|
|
22 invoke_function(f, &a);
|
|
23 });
|
|
24 return 0;
|
|
25 }
|