Skip to content

Commit

Permalink
[LLVM][OpenMP] Add "nowait" clause as valid for "workshare" (#88426)
Browse files Browse the repository at this point in the history
Add the "nowait" clause to the list of allowed clauses for the "workshare"
directive. This will make it consistent with other directives (which are
shared between C/C++ and Fortran).

The parser will still reject "nowait" on "!$omp workshare", so this has no
effect on accepting/rejecting Fortran source code.
  • Loading branch information
kparzysz authored Apr 12, 2024
1 parent 6dbd4bb commit 4078afc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions flang/lib/Semantics/check-omp-structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static const OmpDirectiveSet noWaitClauseNotAllowedSet{
Directive::OMPD_do_simd,
Directive::OMPD_sections,
Directive::OMPD_single,
Directive::OMPD_workshare,
};
} // namespace omp
} // namespace llvm
Expand Down
3 changes: 3 additions & 0 deletions flang/test/Semantics/OpenMP/clause-validity01.f90
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@
a = 1.0
!ERROR: COPYPRIVATE clause is not allowed on the END WORKSHARE directive
!$omp end workshare nowait copyprivate(a)
!$omp workshare nowait
!ERROR: NOWAIT clause is not allowed on the WORKSHARE directive, use it on OMP END WORKSHARE directive
!$omp end workshare
!$omp end parallel

! 2.8.1 simd-clause -> safelen-clause |
Expand Down
3 changes: 3 additions & 0 deletions llvm/include/llvm/Frontend/OpenMP/OMP.td
Original file line number Diff line number Diff line change
Expand Up @@ -2115,6 +2115,9 @@ def OMP_scope : Directive<"scope"> {
let association = AS_Block;
}
def OMP_Workshare : Directive<"workshare"> {
let allowedOnceClauses = [
VersionedClause<OMPC_NoWait>
];
let association = AS_Block;
}
def OMP_ParallelWorkshare : Directive<"parallel workshare"> {
Expand Down

0 comments on commit 4078afc

Please sign in to comment.