[PATCH] D95473: [flang][openacc] Fix clause restriction for host_data directive

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 26 12:46:05 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 HOST_DATA directive were not fully correct.
This patch fixes the situation. The if and if_present clauses are allowed
only once.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95473

Files:
  flang/test/Semantics/OpenACC/acc-host-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
@@ -506,7 +506,7 @@
 
 // 2.8
 def ACC_HostData : Directive<"host_data"> {
-  let allowedClauses = [
+  let allowedOnceClauses = [
     VersionedClause<ACCC_If>,
     VersionedClause<ACCC_IfPresent>
   ];
Index: flang/test/Semantics/OpenACC/acc-host-data.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-host-data.f90
+++ flang/test/Semantics/OpenACC/acc-host-data.f90
@@ -27,9 +27,14 @@
   !$acc host_data use_device(aa, bb) if_present
   !$acc end host_data
 
+  !ERROR: At most one IF_PRESENT clause can appear on the HOST_DATA directive
+  !$acc host_data use_device(aa, bb) if_present if_present
+  !$acc end host_data
+
   !$acc host_data use_device(aa, bb) if(.true.) if_present
   !$acc end host_data
 
+  !ERROR: At most one IF clause can appear on the HOST_DATA directive
   !$acc host_data use_device(aa, bb) if(.true.) if(ifCondition)
   !$acc end host_data
 


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


More information about the llvm-commits mailing list