Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / libomptarget / test / api / omp_dynamic_shared_memory.c
blob5095a69a375c94743a91f1bc81a744971e5eb10f
1 // RUN: %libomptarget-compile-generic
2 // RUN: env LIBOMPTARGET_SHARED_MEMORY_SIZE=256 \
3 // RUN: %libomptarget-run-generic | %fcheck-generic
5 // RUN: %libomptarget-compileopt-generic
6 // RUN: env LIBOMPTARGET_SHARED_MEMORY_SIZE=256 \
7 // RUN: %libomptarget-run-generic | %fcheck-generic
9 // UNSUPPORTED: x86_64-pc-linux-gnu
10 // UNSUPPORTED: x86_64-pc-linux-gnu-LTO
11 // UNSUPPORTED: aarch64-unknown-linux-gnu
12 // UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
14 #include <omp.h>
15 #include <stdio.h>
17 int main() {
18 int x;
19 #pragma omp target parallel map(from : x)
21 int *buf = llvm_omp_target_dynamic_shared_alloc() + 252;
22 #pragma omp barrier
23 if (omp_get_thread_num() == 0)
24 *buf = 1;
25 #pragma omp barrier
26 if (omp_get_thread_num() == 1)
27 x = *buf;
30 // CHECK: PASS
31 if (x == 1 && llvm_omp_target_dynamic_shared_alloc() == NULL)
32 printf("PASS\n");