| 1 |
! Test that reductions and delayed privatization work properly togehter. Since |
| 2 |
! both types of clauses add block arguments to the OpenMP region, we make sure |
| 3 |
! that the block arguments are added in the proper order (reductions first and |
| 4 |
! then delayed privatization. |
| 5 |
|
| 6 |
! RUN: bbc -emit-hlfir -fopenmp --force-byref-reduction --openmp-enable-delayed-privatization -o - %s 2>&1 | FileCheck %s |
| 7 |
|
| 8 |
subroutine red_and_delayed_private |
| 9 |
integer :: red |
| 10 |
integer :: prv |
| 11 |
|
| 12 |
red = 0 |
| 13 |
prv = 10 |
| 14 |
|
| 15 |
!$omp parallel reduction(+:red) private(prv) |
| 16 |
red = red + 1 |
| 17 |
prv = 20 |
| 18 |
!$omp end parallel |
| 19 |
end subroutine |
| 20 |
|
| 21 |
! CHECK-LABEL: omp.private {type = private} |
| 22 |
! CHECK-SAME: @[[PRIVATIZER_SYM:.*]] : !fir.ref<i32> alloc { |
| 23 |
|
| 24 |
! CHECK-LABEL: omp.declare_reduction |
| 25 |
! CHECK-SAME: @[[REDUCTION_SYM:.*]] : !fir.ref<i32> init |
| 26 |
|
| 27 |
! CHECK-LABEL: _QPred_and_delayed_private |
| 28 |
! CHECK: omp.parallel |
| 29 |
! CHECK-SAME: reduction(byref @[[REDUCTION_SYM]] %{{.*}} -> %arg0 : !fir.ref<i32>) |
| 30 |
! CHECK-SAME: private(@[[PRIVATIZER_SYM]] %{{.*}} -> %arg1 : !fir.ref<i32>) { |