[llvm-branch-commits] [llvm] a366188 - [flang][openacc] Add clause validaty tests for data construct + fix default restriction

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Dec 4 12:16:33 PST 2020


Author: Valentin Clement
Date: 2020-12-04T15:12:15-05:00
New Revision: a366188d801ccefb4ef3f9d89415e97accc77443

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

LOG: [flang][openacc] Add clause validaty tests for data construct + fix default restriction

Add clause validity tests for the data construct. The default clause can appear only once
and this was not enforce in the ACC.td.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D91888

Added: 
    

Modified: 
    flang/test/Semantics/acc-clause-validity.f90
    llvm/include/llvm/Frontend/OpenACC/ACC.td

Removed: 
    


################################################################################
diff  --git a/flang/test/Semantics/acc-clause-validity.f90 b/flang/test/Semantics/acc-clause-validity.f90
index b2fb57796f3f..64e6ca887b6c 100644
--- a/flang/test/Semantics/acc-clause-validity.f90
+++ b/flang/test/Semantics/acc-clause-validity.f90
@@ -131,7 +131,42 @@ program openacc_clause_validity
   !$acc data
   !$acc end data
 
-  !$acc data copyin(i)
+  !$acc data copy(aa) if(.true.)
+  !$acc end data
+
+  !$acc data copy(aa) if(ifCondition)
+  !$acc end data
+
+  !$acc data copy(aa, bb, cc)
+  !$acc end data
+
+  !$acc data copyin(aa) copyin(readonly: bb) copyout(cc)
+  !$acc end data
+
+  !$acc data copyin(readonly: aa, bb) copyout(zero: cc)
+  !$acc end data
+
+  !$acc data create(aa, bb(:,:)) create(zero: cc(:,:))
+  !$acc end data
+
+  !$acc data no_create(aa) present(bb, cc)
+  !$acc end data
+
+  !$acc data deviceptr(aa) attach(bb, cc)
+  !$acc end data
+
+  !$acc data copy(aa, bb) default(none)
+  !$acc end data
+
+  !$acc data copy(aa, bb) default(present)
+  !$acc end data
+
+  !ERROR: At most one DEFAULT clause can appear on the DATA directive
+  !$acc data copy(aa, bb) default(none) default(present)
+  !$acc end data
+
+  !ERROR: At most one IF clause can appear on the DATA directive
+  !$acc data copy(aa) if(.true.) if(ifCondition)
   !$acc end data
 
   !$acc data copyin(i)

diff  --git a/llvm/include/llvm/Frontend/OpenACC/ACC.td b/llvm/include/llvm/Frontend/OpenACC/ACC.td
index 10fe344e0ea0..eaca44f6b158 100644
--- a/llvm/include/llvm/Frontend/OpenACC/ACC.td
+++ b/llvm/include/llvm/Frontend/OpenACC/ACC.td
@@ -257,7 +257,8 @@ def ACC_Atomic : Directive<"atomic"> {}
 // 2.6.5
 def ACC_Data : Directive<"data"> {
   let allowedOnceClauses = [
-    VersionedClause<ACCC_If>
+    VersionedClause<ACCC_If>,
+    VersionedClause<ACCC_Default>
   ];
   let requiredClauses = [
     VersionedClause<ACCC_Attach>,


        


More information about the llvm-branch-commits mailing list