Skip to content

Commit 4078afc

Browse files
authored
[LLVM][OpenMP] Add "nowait" clause as valid for "workshare" (#88426)
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.
1 parent 6dbd4bb commit 4078afc

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

flang/lib/Semantics/check-omp-structure.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ static const OmpDirectiveSet noWaitClauseNotAllowedSet{
4242
Directive::OMPD_do_simd,
4343
Directive::OMPD_sections,
4444
Directive::OMPD_single,
45+
Directive::OMPD_workshare,
4546
};
4647
} // namespace omp
4748
} // namespace llvm

flang/test/Semantics/OpenMP/clause-validity01.f90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,9 @@
342342
a = 1.0
343343
!ERROR: COPYPRIVATE clause is not allowed on the END WORKSHARE directive
344344
!$omp end workshare nowait copyprivate(a)
345+
!$omp workshare nowait
346+
!ERROR: NOWAIT clause is not allowed on the WORKSHARE directive, use it on OMP END WORKSHARE directive
347+
!$omp end workshare
345348
!$omp end parallel
346349

347350
! 2.8.1 simd-clause -> safelen-clause |

llvm/include/llvm/Frontend/OpenMP/OMP.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,6 +2115,9 @@ def OMP_scope : Directive<"scope"> {
21152115
let association = AS_Block;
21162116
}
21172117
def OMP_Workshare : Directive<"workshare"> {
2118+
let allowedOnceClauses = [
2119+
VersionedClause<OMPC_NoWait>
2120+
];
21182121
let association = AS_Block;
21192122
}
21202123
def OMP_ParallelWorkshare : Directive<"parallel workshare"> {

0 commit comments

Comments
 (0)