1 // RUN: %clang_cc1 %s -o - -O0 -emit-llvm \
2 // RUN: -triple spir64-unknown-unknown \
3 // RUN: -aux-triple x86_64-unknown-linux-gnu \
4 // RUN: -fsycl-is-device \
5 // RUN: -finclude-default-header \
6 // RUN: -debug-info-kind=limited -gno-column-info \
9 // In spir functions, validate the llvm.dbg.declare intrinsics created for
10 // parameters and locals refer to the stack allocation in the alloca address
14 #define KERNEL __attribute__((sycl_kernel))
16 template <typename KernelName
, typename KernelType
>
17 KERNEL
void parallel_for(const KernelType
&KernelFunc
) {
21 void my_kernel(int my_param
) {
27 parallel_for
<class K
>([=]() { my_kernel(42); });
31 // CHECK: define {{.*}}spir_func void @_Z9my_kerneli(
32 // CHECK-SAME i32 %my_param
33 // CHECK-SAME: !dbg [[MY_KERNEL:![0-9]+]]
35 // CHECK: %my_param.addr = alloca i32, align 4
36 // CHECK: %my_local = alloca i32, align 4
37 // CHECK: call void @llvm.dbg.declare(
38 // CHECK-SAME: metadata i32* %my_param.addr,
39 // CHECK-SAME: metadata [[MY_PARAM:![0-9]+]],
40 // CHECK-SAME: metadata !DIExpression(DW_OP_constu, 4, DW_OP_swap, DW_OP_xderef)
42 // CHECK: call void @llvm.dbg.declare(
43 // CHECK-SAME: metadata i32* %my_local,
44 // CHECK-SAME: metadata [[MY_LOCAL:![0-9]+]],
45 // CHECK-SAME: metadata !DIExpression(DW_OP_constu, 4, DW_OP_swap, DW_OP_xderef)
49 // CHECK: [[MY_KERNEL]] = distinct !DISubprogram(
50 // CHECK-SAME: name: "my_kernel"
52 // CHECK: [[MY_PARAM]] = !DILocalVariable(
53 // CHECK-SAME: name: "my_param"
55 // CHECK-SAME: scope: [[MY_KERNEL]]
57 // CHECK: [[MY_LOCAL]] = !DILocalVariable(
58 // CHECK-SAME: name: "my_local"
59 // CHECK-SAME: scope: [[MY_KERNEL]]