42 lines · plain
1// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -emit-llvm -o - -triple amdgcn < %s | FileCheck %s --check-prefixes=COMMON,AMDGPU2// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -emit-llvm -o - -triple "spir-unknown-unknown" < %s | FileCheck %s --check-prefixes=COMMON,SPIR32,SPIR3// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -emit-llvm -o - -triple "spir64-unknown-unknown" < %s | FileCheck %s --check-prefixes=COMMON,SPIR64,SPIR4// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -debug-info-kind=limited -gno-column-info -emit-llvm -o - -triple amdgcn < %s | FileCheck %s --check-prefixes=CHECK-DEBUG5 6// Check that the enqueue_kernel array temporary is in the entry block to avoid7// a dynamic alloca8 9typedef struct {int a;} ndrange_t;10 11kernel void test(int i) {12// AMDGPU-LABEL: define {{.*}} amdgpu_kernel void @test13// SPIR-LABEL: define {{.*}} spir_kernel void @test14 15// COMMON-LABEL: entry:16// AMDGPU: %block_sizes = alloca [1 x i64]17// SPIR32: %block_sizes = alloca [1 x i32]18// SPIR64: %block_sizes = alloca [1 x i64]19// COMMON-LABEL: if.then:20// COMMON-NOT: alloca21// CHECK-DEBUG: getelementptr {{.*}} %block_sizes{{.*}}, {{.*}} !dbg ![[TEMPLOCATION:[0-9]+]]22// COMMON-LABEL: if.end23 queue_t default_queue;24 unsigned flags = 0;25 ndrange_t ndrange;26 if (i)27 enqueue_kernel(default_queue, flags, ndrange, ^(local void *a) { }, 32);28}29 30// AMDGPU-LABEL: define internal void @__test_block_invoke(31// SPIR-LABEL: define internal spir_func void @__test_block_invoke(32 33// AMDGPU-LABEL: define internal amdgpu_kernel void @__test_block_invoke_kernel34// SPIR-LABEL: define spir_kernel void @__test_block_invoke_kernel35 36// Check that the temporary is scoped to the `if`37 38// CHECK-DEBUG: ![[TESTFILE:[0-9]+]] = !DIFile(filename: "<stdin>"39// CHECK-DEBUG: ![[TESTSCOPE:[0-9]+]] = distinct !DISubprogram(name: "test", linkageName: "__clang_ocl_kern_imp_test", {{.*}} file: ![[TESTFILE]]40// CHECK-DEBUG: ![[IFSCOPE:[0-9]+]] = distinct !DILexicalBlock(scope: ![[TESTSCOPE]], file: ![[TESTFILE]], line: 26)41// CHECK-DEBUG: ![[TEMPLOCATION]] = !DILocation(line: 27, scope: ![[IFSCOPE]])42