Skip to content

Commit 71c3449

Browse files
[Flang][OpenMP] : Add a temporary lowering for workshare directive
As a temporary solution, lower workshare to the single directive
1 parent 1074b94 commit 71c3449

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

flang/lib/Lower/OpenMP.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3312,7 +3312,11 @@ genOMP(Fortran::lower::AbstractConverter &converter,
33123312
/*outerCombined=*/false);
33133313
break;
33143314
case llvm::omp::Directive::OMPD_workshare:
3315-
TODO(currentLocation, "Workshare construct");
3315+
// FIXME: Workshare is not a commonly used OpenMP construct, an
3316+
// implementation for this feature will come later. For the codes
3317+
// that use this construct, add a single construct for now.
3318+
genSingleOp(converter, eval, currentLocation, beginClauseList,
3319+
endClauseList);
33163320
break;
33173321
default: {
33183322
// Codegen for combined directives

flang/test/Lower/OpenMP/workshare.f90

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
3+
4+
!CHECK-LABEL: func @_QPsb
5+
subroutine sb(arr)
6+
integer :: arr(:)
7+
!CHECK: omp.parallel {
8+
!$omp parallel
9+
!CHECK: omp.single {
10+
!$omp workshare
11+
arr = 0
12+
!$omp end workshare
13+
!CHECK: }
14+
!$omp end parallel
15+
!CHECK: }
16+
end subroutine

0 commit comments

Comments
 (0)