Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / libomptarget / test / offloading / fortran / declare-target-array-in-target-region.f90
blobf5e3ae00653a9ab2b3389468bf6ad2ea4871c3e4
1 ! Offloading test with a target region mapping a declare target
2 ! Fortran array writing some values to it and checking the host
3 ! correctly receives the updates made on the device.
4 ! REQUIRES: flang, amdgcn-amd-amdhsa
5 ! UNSUPPORTED: nvptx64-nvidia-cuda
6 ! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
7 ! UNSUPPORTED: aarch64-unknown-linux-gnu
8 ! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
9 ! UNSUPPORTED: x86_64-pc-linux-gnu
10 ! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
12 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
13 module test_0
14 implicit none
15 INTEGER :: sp(10) = (/0,0,0,0,0,0,0,0,0,0/)
16 !$omp declare target link(sp)
17 end module test_0
19 program main
20 use test_0
21 integer :: i = 1
22 integer :: j = 11
23 !$omp target map(tofrom:sp, i, j)
24 do while (i <= j)
25 sp(i) = i;
26 i = i + 1
27 end do
28 !$omp end target
30 PRINT *, sp(:)
32 end program
34 ! CHECK: 1 2 3 4 5 6 7 8 9 10