diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp --- a/flang/lib/Lower/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP.cpp @@ -837,6 +837,12 @@ /*in_reductions=*/nullptr, priorityClauseOperand, allocateOperands, allocatorOperands); createBodyOfOp(taskOp, converter, currentLocation, eval, &opClauseList); + } else if (blockDirective.v == llvm::omp::OMPD_taskgroup) { + auto taskGroupOp = firOpBuilder.create( + currentLocation, /*task_reduction_vars=*/ValueRange(), + /*task_reductions=*/nullptr, allocateOperands, allocateOperands); + createBodyOfOp(taskGroupOp, converter, currentLocation, eval, + &opClauseList); } else { TODO(converter.getCurrentLocation(), "Unhandled block directive"); } diff --git a/flang/test/Lower/OpenMP/taskgroup.f90 b/flang/test/Lower/OpenMP/taskgroup.f90 new file mode 100644 --- /dev/null +++ b/flang/test/Lower/OpenMP/taskgroup.f90 @@ -0,0 +1,15 @@ +!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect" +!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="OMPDialect" + +!FIRDialect-LABEL: @_QPomp_taskgroup +subroutine omp_taskgroup + !OMPDialect: omp.taskgroup +!$omp taskgroup +!$omp task +!FIRDialect: fir.call @_QPwork() : () -> () + call work() +!OMPDialect: omp.terminator +!$omp end task +!OMPDialect: omp.terminator +!$omp end taskgroup +end subroutine