[PATCH] D89861: [Flang][OpenMP 4.5] Add semantic check for OpenMP default clause
Yashaswini Hegde via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 21 02:54:01 PDT 2020
yhegde created this revision.
yhegde added reviewers: kiranchandramohan, richard.barton.arm, DavidTruby.
yhegde added projects: Flang, OpenMP, LLVM.
Herald added subscribers: llvm-commits, jdoerfert, guansong, yaxunl.
yhegde requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.
Semantic check for OpenMP 4.5 - 2.15.3.1 default clause
Test cases :
omp-parallel-default.f90
omp-task-default.f90
omp-taskloop-default.f90
omp-teams-default.f90
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D89861
Files:
flang/test/Semantics/omp-parallel-default.f90
flang/test/Semantics/omp-task-default.f90
flang/test/Semantics/omp-taskloop-default.f90
flang/test/Semantics/omp-teams-default.f90
llvm/include/llvm/Frontend/OpenMP/OMP.td
Index: llvm/include/llvm/Frontend/OpenMP/OMP.td
===================================================================
--- llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -306,6 +306,7 @@
VersionedClause<OMPC_Allocate>
];
let allowedOnceClauses = [
+ VersionedClause<OMPC_Default>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_NumThreads>,
VersionedClause<OMPC_ProcBind>,
@@ -326,6 +327,7 @@
VersionedClause<OMPC_Affinity, 50>
];
let allowedOnceClauses = [
+ VersionedClause<OMPC_Default>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Final>,
VersionedClause<OMPC_Priority>
@@ -816,6 +818,7 @@
VersionedClause<OMPC_Allocate>
];
let allowedOnceClauses = [
+ VersionedClause<OMPC_Default>,
VersionedClause<OMPC_If>,
VersionedClause<OMPC_Collapse>,
VersionedClause<OMPC_Final>,
Index: flang/test/Semantics/omp-teams-default.f90
===================================================================
--- /dev/null
+++ flang/test/Semantics/omp-teams-default.f90
@@ -0,0 +1,12 @@
+!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! OpenMP Version 4.5
+! 2.15.3.1 default Clause
+program omp_teams_default
+ integer :: a(10), b(10), c(10),i,k
+ !ERROR: At most one DEFAULT clause can appear on the TEAMS directive
+ !$omp teams default(shared), default(none),shared(i,a,b,k,c)
+ do i = 1, 10
+ c(i) = a(i) + b(i) + k
+ end do
+ !$omp end teams
+end program omp_teams_default
Index: flang/test/Semantics/omp-taskloop-default.f90
===================================================================
--- /dev/null
+++ flang/test/Semantics/omp-taskloop-default.f90
@@ -0,0 +1,12 @@
+!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! OpenMP Version 4.5
+! 2.15.3.1 default Clause
+program omp_taskloop_default
+ integer :: a(10), b(10), c(10),i,k
+ !ERROR: At most one DEFAULT clause can appear on the TASKLOOP directive
+ !$omp taskloop default(shared), default(private)
+ do i = 1, 10
+ c(i) = a(i) + b(i) + k
+ end do
+ !$omp end taskloop
+end program omp_taskloop_default
Index: flang/test/Semantics/omp-task-default.f90
===================================================================
--- /dev/null
+++ flang/test/Semantics/omp-task-default.f90
@@ -0,0 +1,12 @@
+!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! OpenMP Version 4.5
+! 2.15.3.1 default Clause
+program omp_task_default
+ integer :: a(10), b(10), c(10),i,k
+ !ERROR: At most one DEFAULT clause can appear on the TASK directive
+ !$omp task default(shared), default(none),shared(a,b,c,k,i)
+ do i = 1, 10
+ c(i) = a(i) + b(i) + k
+ end do
+ !$omp end task
+end program omp_task_default
Index: flang/test/Semantics/omp-parallel-default.f90
===================================================================
--- /dev/null
+++ flang/test/Semantics/omp-parallel-default.f90
@@ -0,0 +1,12 @@
+!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! OpenMP Version 4.5
+! 2.15.3.1 default Clause
+program omp_parallel_default
+ integer :: a(10), b(10), c(10),i,k
+ !ERROR: At most one DEFAULT clause can appear on the PARALLEL directive
+ !$omp parallel default(shared), default(private)
+ do i = 1, 10
+ c(i) = a(i) + b(i) + k
+ end do
+ !$omp end parallel
+end program omp_parallel_default
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89861.299612.patch
Type: text/x-patch
Size: 3289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201021/980c4d13/attachment.bin>
More information about the llvm-commits
mailing list