From b2fb93d6818e724e8c4fcb2309e7fd63a8cb2d01 Mon Sep 17 00:00:00 2001 From: Raghu Maddhipatla Date: Thu, 12 Jan 2023 00:32:06 -0600 Subject: [PATCH] [Flang] [OpenMP] Refine parser restrictions for OMP TARGET UPDATE clauses. In Parser, move some clauses of OMP TARGET UPDATE to allowedOnceClauses so that restrictions will be imposed. Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D141567 --- flang/test/Semantics/OpenMP/omp-device-constructs.f90 | 8 ++++++++ llvm/include/llvm/Frontend/OpenMP/OMP.td | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/flang/test/Semantics/OpenMP/omp-device-constructs.f90 b/flang/test/Semantics/OpenMP/omp-device-constructs.f90 index cbd3775..51f0070 100644 --- a/flang/test/Semantics/OpenMP/omp-device-constructs.f90 +++ b/flang/test/Semantics/OpenMP/omp-device-constructs.f90 @@ -162,6 +162,14 @@ program main !ERROR: Only the FROM, RELEASE, DELETE map types are permitted for MAP clauses on the TARGET EXIT DATA directive !$omp target exit data map(to:a) + !$omp target update if(.true.) device(1) to(a) from(b) depend(inout:c) nowait + + !ERROR: At most one IF clause can appear on the TARGET UPDATE directive + !$omp target update to(a) if(.true.) if(.false.) + + !ERROR: At most one DEVICE clause can appear on the TARGET UPDATE directive + !$omp target update device(0) device(1) from(b) + !$omp target !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. !$omp distribute diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td index 3713761..0b87b6e 100644 --- a/llvm/include/llvm/Frontend/OpenMP/OMP.td +++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td @@ -798,13 +798,15 @@ def OMP_TargetParallelDo : Directive<"target parallel do"> { } def OMP_TargetUpdate : Directive<"target update"> { let allowedClauses = [ - VersionedClause, - VersionedClause, VersionedClause, VersionedClause, - VersionedClause, VersionedClause ]; + let allowedOnceClauses = [ + VersionedClause, + VersionedClause, + VersionedClause + ]; } def OMP_ParallelFor : Directive<"parallel for"> { let allowedClauses = [ -- 2.7.4