Files
clang-p2996/flang/test/Lower/OpenMP/wsloop-ordered.f90
Sergio Afonso 0a17bdfc36 [MLIR][OpenMP] Remove terminators from loop wrappers (#112229)
This patch simplifies the representation of OpenMP loop wrapper
operations by introducing the `NoTerminator` trait and updating
accordingly the verifier for the `LoopWrapperInterface`.

Since loop wrappers are already limited to having exactly one region
containing exactly one block, and this block can only hold a single
`omp.loop_nest` or loop wrapper and an `omp.terminator` that does not
return any values, it makes sense to simplify the representation of loop
wrappers by removing the terminator.

There is an extensive list of Lit tests that needed updating to remove
the `omp.terminator`s adding some noise to this patch, but actual
changes are limited to the definition of the `omp.wsloop`, `omp.simd`,
`omp.distribute` and `omp.taskloop` loop wrapper ops, Flang lowering for
those, `LoopWrapperInterface::verifyImpl()`, SCF to OpenMP conversion
and OpenMP dialect documentation.
2024-10-15 11:28:39 +01:00

45 lines
1.1 KiB
Fortran

! This test checks lowering of worksharing-loop construct with ordered clause.
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
! This checks lowering ordered clause specified without parameter
subroutine wsloop_ordered_no_para()
integer :: a(10), i
! CHECK: omp.wsloop ordered(0) {
! CHECK-NEXT: omp.loop_nest (%{{.*}}) : i32 = (%{{.*}}) to (%{{.*}}) inclusive step (%{{.*}}) {
! CHECK: omp.yield
! CHECK: }
! CHECK: }
!$omp do ordered
do i = 2, 10
!$omp ordered
a(i) = a(i-1) + 1
!$omp end ordered
end do
!$omp end do
end
! This checks lowering ordered clause specified with a parameter
subroutine wsloop_ordered_with_para()
integer :: a(10), i
! CHECK: func @_QPwsloop_ordered_with_para() {
! CHECK: omp.wsloop ordered(1) {
! CHECK-NEXT: omp.loop_nest (%{{.*}}) : i32 = (%{{.*}}) to (%{{.*}}) inclusive step (%{{.*}}) {
! CHECK: omp.yield
! CHECK: }
! CHECK: }
!$omp do ordered(1)
do i = 2, 10
!!$omp ordered depend(sink: i-1)
a(i) = a(i-1) + 1
!!$omp ordered depend(source)
end do
!$omp end do
end