Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion flang/lib/Semantics/resolve-names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,6 @@ bool OmpVisitor::NeedsScope(const parser::OpenMPBlockConstruct &x) {
switch (beginDir.v) {
case llvm::omp::Directive::OMPD_master:
case llvm::omp::Directive::OMPD_ordered:
case llvm::omp::Directive::OMPD_taskgroup:
return false;
default:
return true;
Expand Down
32 changes: 32 additions & 0 deletions flang/test/Lower/OpenMP/taskgroup02.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
! RUN: %flang_fc1 -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s

! Check that variables are not privatized twice when TASKGROUP is used.

!CHECK-LABEL: func.func @_QPsub() {
!CHECK: omp.parallel {
!CHECK: %[[PAR_I:.*]]:2 = hlfir.declare %{{.*}} {uniq_name = "_QFsubEi"}
!CHECK: omp.master {
!CHECK: omp.taskgroup {
!CHECK-NEXT: omp.task private(@_QFsubEi_firstprivate_i32 %[[PAR_I]]#0 -> %[[TASK_I:.*]] : !fir.ref<i32>) {
!CHECK: %[[TASK_I_DECL:.*]]:2 = hlfir.declare %[[TASK_I]] {uniq_name = "_QFsubEi"}
!CHECK: }
!CHECK: }
!CHECK: }
!CHECK: }

subroutine sub()
integer, dimension(10) :: a
integer :: i

!$omp parallel
!$omp master
do i=1,10
!$omp taskgroup
!$omp task shared(a)
a(i) = 1
!$omp end task
!$omp end taskgroup
end do
!$omp end master
!$omp end parallel
end subroutine
Loading