Kareem Ergawy dcb124e820
[flang][OpenMP] Enable delayed privatization by default omp.wsloop (#125732)
Reapplies #122471

This is based on https://github.com/llvm/llvm-project/pull/125699, only
the latest commit is relevant.

With changes in this PR and the parent one, the previously reported
failures in the Fujitsu(*) test suite should hopefully be resolved (I
verified all the 14 reported failures and they pass now).

(*) https://linaro.atlassian.net/browse/LLVM-1521
2025-02-06 19:11:04 +01:00

71 lines
1.8 KiB
Fortran

! This test checks location of OpenMP constructs and clauses
!RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --mlir-print-debuginfo %s -o - | FileCheck %s
!CHECK-LABEL: sub_parallel
subroutine sub_parallel()
print *, x
!CHECK: omp.parallel {
!$omp parallel
print *, x
!CHECK: omp.terminator loc(#[[PAR_LOC:.*]])
!CHECK: } loc(#[[PAR_LOC]])
!$omp end parallel
print *, x
end
!CHECK-LABEL: sub_target
subroutine sub_target()
print *, x
!CHECK: omp.target {{.*}} {
!$omp target
print *, x
!CHECK: omp.terminator loc(#[[TAR_LOC:.*]])
!CHECK: } loc(#[[TAR_LOC]])
!$omp end target
print *, x
end
!CHECK-LABEL: sub_loop
subroutine sub_loop()
!CHECK: omp.wsloop private({{.*}}) {
!CHECK-NEXT: omp.loop_nest {{.*}} {
!$omp do
do i=1,10
print *, i
!CHECK: omp.yield loc(#[[LOOP_LOC:.*]])
!CHECK: } loc(#[[LOOP_LOC]])
!CHECK: } loc(#[[LOOP_LOC]])
end do
!$omp end do
end
!CHECK-LABEL: sub_standalone
subroutine sub_standalone()
!CHECK: omp.barrier loc(#[[BAR_LOC:.*]])
!$omp barrier
!CHECK: omp.taskwait loc(#[[TW_LOC:.*]])
!$omp taskwait
!CHECK: omp.taskyield loc(#[[TY_LOC:.*]])
!$omp taskyield
end
subroutine sub_if(c)
logical(kind=4) :: c
!CHECK: %[[CVT:.*]] = fir.convert %{{.*}} : (!fir.logical<4>) -> i1 loc(#[[IF_LOC:.*]])
!CHECK: omp.task if(%[[CVT]])
!$omp task if(c)
print *, "Task"
!$omp end task
!CHECK: } loc(#[[TASK_LOC:.*]])
end subroutine
!CHECK: #[[PAR_LOC]] = loc("{{.*}}location.f90":9:9)
!CHECK: #[[TAR_LOC]] = loc("{{.*}}location.f90":21:9)
!CHECK: #[[LOOP_LOC]] = loc("{{.*}}location.f90":33:9)
!CHECK: #[[BAR_LOC]] = loc("{{.*}}location.f90":46:9)
!CHECK: #[[TW_LOC]] = loc("{{.*}}location.f90":48:9)
!CHECK: #[[TY_LOC]] = loc("{{.*}}location.f90":50:9)
!CHECK: #[[IF_LOC]] = loc("{{.*}}location.f90":57:14)
!CHECK: #[[TASK_LOC]] = loc("{{.*}}location.f90":57:9)