| 1 |
!RUN: bbc -fopenmp -emit-hlfir -o - %s | FileCheck %s |
| 2 |
|
| 3 |
!https://github.com/llvm/llvm-project/issues/91205 |
| 4 |
|
| 5 |
!CHECK: omp.parallel if(%{{[0-9]+}}) { |
| 6 |
!CHECK: %[[THP1:[0-9]+]] = omp.threadprivate %{{[0-9]+}}#1 |
| 7 |
!CHECK: %[[DCL1:[0-9]+]]:2 = hlfir.declare %[[THP1]] {uniq_name = "_QFcopyin_scalar_arrayEx1"} |
| 8 |
!CHECK: %[[LD1:[0-9]+]] = fir.load %{{[0-9]+}}#0 |
| 9 |
!CHECK: hlfir.assign %[[LD1]] to %[[DCL1]]#0 temporary_lhs |
| 10 |
!CHECK: %[[THP2:[0-9]+]] = omp.threadprivate %{{[0-9]+}}#1 |
| 11 |
!CHECK: %[[SHP2:[0-9]+]] = fir.shape %c{{[0-9]+}} |
| 12 |
!CHECK: %[[DCL2:[0-9]+]]:2 = hlfir.declare %[[THP2]](%[[SHP2]]) {uniq_name = "_QFcopyin_scalar_arrayEx2"} |
| 13 |
!CHECK: hlfir.assign %{{[0-9]+}}#0 to %[[DCL2]]#0 temporary_lhs |
| 14 |
!CHECK: omp.barrier |
| 15 |
!CHECK: fir.call @_QPsub1(%[[DCL1]]#1, %[[DCL2]]#1) |
| 16 |
!CHECK: omp.terminator |
| 17 |
!CHECK: } |
| 18 |
|
| 19 |
subroutine copyin_scalar_array() |
| 20 |
integer(kind=4), save :: x1 |
| 21 |
integer(kind=8), save :: x2(10) |
| 22 |
!$omp threadprivate(x1, x2) |
| 23 |
|
| 24 |
! Have x1 appear before x2 in the AST node for the `parallel` construct, |
| 25 |
! but at the same time have them in a different order in `copyin`. |
| 26 |
!$omp parallel if (x1 .eq. x2(1)) copyin(x2, x1) |
| 27 |
call sub1(x1, x2) |
| 28 |
!$omp end parallel |
| 29 |
|
| 30 |
end |
| 31 |
|