llvm-project/flang/test/Lower/repack-arrays-safe.f90
Slava Zakharin 9aff19e7a3
[flang] Defined SafeTempArrayCopyAttrInterface for array repacking. (#134346)
This patch defines `fir::SafeTempArrayCopyAttrInterface` and the
corresponding
OpenACC/OpenMP related attributes in FIR dialect. The actual
implementations
are just placeholders right now, and array repacking becomes a no-op
if `-fopenacc/-fopenmp` is used for the compilation.
2025-04-10 18:41:54 -07:00

18 lines
1.1 KiB
Fortran

! Test that fir.acc_safe_temp_array_copy and fir.omp_safe_temp_array_copy
! are properly attached to fir.[un]pack_array by the lowering.
! RUN: bbc -emit-hlfir -fopenacc -frepack-arrays %s -o - | FileCheck --check-prefixes=ALL,ACC %s
! RUN: bbc -emit-hlfir -fopenmp -frepack-arrays %s -o - | FileCheck --check-prefixes=ALL,OMP %s
! RUN: bbc -emit-hlfir -fopenacc -fopenmp -frepack-arrays %s -o - | FileCheck --check-prefixes=ALL,ACCOMP %s
subroutine test(x)
real :: x(:)
end subroutine test
! ALL-LABEL: func.func @_QPtest(
! ACC: %[[VAL_2:.*]] = fir.pack_array{{.*}}is_safe [#fir.acc_safe_temp_array_copy]
! ACC: fir.unpack_array{{.*}}is_safe [#fir.acc_safe_temp_array_copy]
! OMP: %[[VAL_2:.*]] = fir.pack_array{{.*}}is_safe [#fir.omp_safe_temp_array_copy]
! OMP: fir.unpack_array{{.*}}is_safe [#fir.omp_safe_temp_array_copy]
! ACCOMP: %[[VAL_2:.*]] = fir.pack_array{{.*}}is_safe [#fir.acc_safe_temp_array_copy, #fir.omp_safe_temp_array_copy]
! ACCOMP: fir.unpack_array{{.*}}is_safe [#fir.acc_safe_temp_array_copy, #fir.omp_safe_temp_array_copy]