]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGenOpenCL/enqueue-kernel-non-entry-block.cl
Vendor import of clang trunk r351319 (just before the release_80 branch
[FreeBSD/FreeBSD.git] / test / CodeGenOpenCL / enqueue-kernel-non-entry-block.cl
1 // RUN: %clang_cc1 -cl-std=CL2.0 -O0 -emit-llvm -o - -triple amdgcn < %s | FileCheck %s --check-prefixes=COMMON,AMDGPU
2 // RUN: %clang_cc1 -cl-std=CL2.0 -O0 -emit-llvm -o - -triple "spir-unknown-unknown" < %s | FileCheck %s --check-prefixes=COMMON,SPIR32
3 // RUN: %clang_cc1 -cl-std=CL2.0 -O0 -emit-llvm -o - -triple "spir64-unknown-unknown" < %s | FileCheck %s --check-prefixes=COMMON,SPIR64
4 // RUN: %clang_cc1 -cl-std=CL2.0 -O0 -debug-info-kind=limited -emit-llvm -o - -triple amdgcn < %s | FileCheck %s --check-prefixes=CHECK-DEBUG
5
6 // Check that the enqueue_kernel array temporary is in the entry block to avoid
7 // a dynamic alloca
8
9 typedef struct {int a;} ndrange_t;
10
11 kernel void test(int i) {
12 // COMMON-LABEL: define {{.*}} void @test
13 // COMMON-LABEL: entry:
14 // AMDGPU: %block_sizes = alloca [1 x i64]
15 // SPIR32: %block_sizes = alloca [1 x i32]
16 // SPIR64: %block_sizes = alloca [1 x i64]
17 // COMMON-LABEL: if.then:
18 // COMMON-NOT: alloca
19 // CHECK-DEBUG: getelementptr {{.*}} %block_sizes, {{.*}} !dbg ![[TEMPLOCATION:[0-9]+]]
20 // COMMON-LABEL: if.end
21   queue_t default_queue;
22   unsigned flags = 0;
23   ndrange_t ndrange;
24   if (i)
25     enqueue_kernel(default_queue, flags, ndrange, ^(local void *a) { }, 32);
26 }
27
28 // Check that the temporary is scoped to the `if`
29
30 // CHECK-DEBUG: ![[TESTFILE:[0-9]+]] = !DIFile(filename: "<stdin>"
31 // CHECK-DEBUG: ![[TESTSCOPE:[0-9]+]] = distinct !DISubprogram(name: "test", {{.*}} file: ![[TESTFILE]]
32 // CHECK-DEBUG: ![[IFSCOPE:[0-9]+]] = distinct !DILexicalBlock(scope: ![[TESTSCOPE]], file: ![[TESTFILE]], line: 24)
33 // CHECK-DEBUG: ![[TEMPLOCATION]] = !DILocation(line: 25, scope: ![[IFSCOPE]])