[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / depend_iterator_bug.c
blobff11d8a5d0e40394d2b79d01059d68cb6d2d372d
1 // RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-linux-gnu \
2 // RUN: -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s
4 // expected-no-diagnostics
6 int x[100];
7 int y[100];
8 int z[100][100];
10 // CHECK-LABEL: @many_iterators_single_clause(
11 // CHECK: [[VLA:%.*]] = alloca [[STRUCT_KMP_DEPEND_INFO:%.*]], i64 10, align 16
12 // CHECK: = call i32 @__kmpc_omp_task_with_deps(ptr {{.*}}, i32 {{.*}}, ptr {{.*}}, i32 10, ptr {{.*}}, i32 0, ptr null)
13 void many_iterators_single_clause(void) {
14 #pragma omp task depend(iterator(j=0:5), in: x[j], y[j])
19 // CHECK-LABEL: @many_iterators_many_clauses(
20 // CHECK: [[VLA:%.*]] = alloca [[STRUCT_KMP_DEPEND_INFO:%.*]], i64 10, align 16
21 // CHECK: = call i32 @__kmpc_omp_task_with_deps(ptr {{.*}}, i32 {{.*}}, ptr {{.*}}, i32 10, ptr {{.*}}, i32 0, ptr null)
22 void many_iterators_many_clauses(void) {
23 #pragma omp task depend(iterator(j=0:5), in: x[j]) \
24 depend(iterator(j=0:5), in: y[j])
29 // CHECK-LABEL: @multidim_iterators_clause1(
30 // CHECK: [[VLA:%.*]] = alloca [[STRUCT_KMP_DEPEND_INFO:%.*]], i64 1, align 16
31 // CHECK: = call i32 @__kmpc_omp_task_with_deps(ptr {{.*}}, i32 {{.*}}, ptr {{.*}}, i32 1, ptr {{.*}}, i32 0, ptr null)
32 void multidim_iterators_clause1(void) {
33 #pragma omp task depend(iterator(i=0:1, j=0:1), in: z[i][j])
38 // CHECK-LABEL: @multidim_iterators_offset_clause(
39 // CHECK: [[VLA:%.*]] = alloca [[STRUCT_KMP_DEPEND_INFO:%.*]], i64 1, align 16
40 // CHECK: = call i32 @__kmpc_omp_task_with_deps(ptr {{.*}}, i32 {{.*}}, ptr {{.*}}, i32 1, ptr {{.*}}, i32 0, ptr null)
41 void multidim_iterators_offset_clause(void) {
42 #pragma omp task depend(iterator(i=5:6, j=10:11), in: z[i][j])
47 // CHECK-LABEL: @multidim_iterators_clause25(
48 // CHECK: [[VLA:%.*]] = alloca [[STRUCT_KMP_DEPEND_INFO:%.*]], i64 25, align 16
49 // CHECK: = call i32 @__kmpc_omp_task_with_deps(ptr {{.*}}, i32 {{.*}}, ptr {{.*}}, i32 25, ptr {{.*}}, i32 0, ptr null)
50 void multidim_iterators_clause25(void) {
51 #pragma omp task depend(iterator(i=0:5, j=0:5), in: z[i][j])