[PATCH] D95470: [flang][openacc] Fix clause restriction for exit data directive

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 26 12:30:41 PST 2021


clementval created this revision.
clementval added reviewers: kiranchandramohan, SouraVX, kiranktp, sameeranjoshi.
clementval requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Restriction on clauses for the EXIT DATA directive were not fully correct.
This patch fixes the situation. The async, if and finalize clauses are allowed
only once.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95470

Files:
  flang/test/Semantics/OpenACC/acc-data.f90
  llvm/include/llvm/Frontend/OpenACC/ACC.td


Index: llvm/include/llvm/Frontend/OpenACC/ACC.td
===================================================================
--- llvm/include/llvm/Frontend/OpenACC/ACC.td
+++ llvm/include/llvm/Frontend/OpenACC/ACC.td
@@ -492,9 +492,11 @@
 // 2.14.7
 def ACC_ExitData : Directive<"exit data"> {
   let allowedClauses = [
+    VersionedClause<ACCC_Wait>
+  ];
+  let allowedOnceClauses = [
     VersionedClause<ACCC_Async>,
     VersionedClause<ACCC_If>,
-    VersionedClause<ACCC_Wait>,
     VersionedClause<ACCC_Finalize>
   ];
   let requiredClauses = [
Index: flang/test/Semantics/OpenACC/acc-data.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-data.f90
+++ flang/test/Semantics/OpenACC/acc-data.f90
@@ -75,6 +75,9 @@
 
   !$acc exit data delete(aa) finalize
 
+  !ERROR: At most one FINALIZE clause can appear on the EXIT DATA directive
+  !$acc exit data delete(aa) finalize finalize
+
   !$acc exit data detach(cc)
 
   !$acc exit data copyout(bb)
@@ -83,8 +86,14 @@
 
   !$acc exit data delete(aa) if(ifCondition)
 
+  !ERROR: At most one IF clause can appear on the EXIT DATA directive
+  !$acc exit data delete(aa) if(ifCondition) if(.TRUE.)
+
   !$acc exit data delete(aa) async
 
+  !ERROR: At most one ASYNC clause can appear on the EXIT DATA directive
+  !$acc exit data delete(aa) async async
+
   !$acc exit data delete(aa) async(async1)
 
   !$acc exit data delete(aa) async(1)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95470.319382.patch
Type: text/x-patch
Size: 1447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210126/c9010181/attachment.bin>


More information about the llvm-commits mailing list