From: Valentin Clement Date: Fri, 4 Dec 2020 20:12:05 +0000 (-0500) Subject: [flang][openacc] Add clause validaty tests for data construct + fix default restriction X-Git-Tag: llvmorg-13-init~4333 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a366188d801ccefb4ef3f9d89415e97accc77443;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/flang/test/Semantics/acc-clause-validity.f90 b/flang/test/Semantics/acc-clause-validity.f90 index b2fb577..64e6ca8 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 10fe344..eaca44f 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 + VersionedClause, + VersionedClause ]; let requiredClauses = [ VersionedClause,