[flang-commits] [flang] b2fb93d - [Flang] [OpenMP] Refine parser restrictions for OMP TARGET UPDATE clauses.

Raghu Maddhipatla via flang-commits flang-commits at lists.llvm.org
Tue Jan 17 06:43:33 PST 2023


Author: Raghu Maddhipatla
Date: 2023-01-17T08:43:28-06:00
New Revision: b2fb93d6818e724e8c4fcb2309e7fd63a8cb2d01

URL: https://github.com/llvm/llvm-project/commit/b2fb93d6818e724e8c4fcb2309e7fd63a8cb2d01
DIFF: https://github.com/llvm/llvm-project/commit/b2fb93d6818e724e8c4fcb2309e7fd63a8cb2d01.diff

LOG: [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

Added: 
    

Modified: 
    flang/test/Semantics/OpenMP/omp-device-constructs.f90
    llvm/include/llvm/Frontend/OpenMP/OMP.td

Removed: 
    


################################################################################
diff  --git a/flang/test/Semantics/OpenMP/omp-device-constructs.f90 b/flang/test/Semantics/OpenMP/omp-device-constructs.f90
index cbd377575339e..51f00700b6daf 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 371376177051f..0b87b6e4b14ea 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<OMPC_If>,
-    VersionedClause<OMPC_Device>,
     VersionedClause<OMPC_To>,
     VersionedClause<OMPC_From>,
-    VersionedClause<OMPC_NoWait>,
     VersionedClause<OMPC_Depend>
   ];
+  let allowedOnceClauses = [
+    VersionedClause<OMPC_Device>,
+    VersionedClause<OMPC_If>,
+    VersionedClause<OMPC_NoWait>
+  ];
 }
 def OMP_ParallelFor : Directive<"parallel for"> {
   let allowedClauses = [


        


More information about the flang-commits mailing list