| 1 | // clang-format off |
| 2 | // |
| 3 | // RUN: %libomptarget-compileopt-generic -fopenmp-target-jit |
| 4 | // RUN: env LIBOMPTARGET_JIT_PRE_OPT_IR_MODULE=%t.pre.ll \ |
| 5 | // RUN: LIBOMPTARGET_JIT_SKIP_OPT=true \ |
| 6 | // RUN: %libomptarget-run-generic |
| 7 | // RUN: %fcheck-plain-generic --input-file %t.pre.ll %s |
| 8 | // |
| 9 | // clang-format on |
| 10 | |
| 11 | // REQUIRES: gpu |
| 12 | |
| 13 | // Ensure that there is only the kernel function left, not any outlined |
| 14 | // parallel regions. |
| 15 | // |
| 16 | // CHECK: define |
| 17 | // CHECK-NOT: define |
| 18 | |
| 19 | #include <omp.h> |
| 20 | #include <stdio.h> |
| 21 | |
| 22 | void f(long *A, int N) { |
| 23 | long i = 0; |
| 24 | #pragma omp target map(A[ : N]) |
| 25 | { |
| 26 | #pragma omp parallel firstprivate(i) |
| 27 | A[omp_get_thread_num()] = i; |
| 28 | #pragma omp parallel firstprivate(i, N) |
| 29 | A[omp_get_thread_num()] += i + N; |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | int main() { |
| 34 | long A[1]; |
| 35 | f(A: &A[0], N: 1); |
| 36 | printf(format: "%li\n" , A[0]); |
| 37 | return 0; |
| 38 | } |
| 39 | |