[PATCH] D100222: [flang][OpenMP] Modify semantic check for nesting of `ordered` regions to include `close` nesting check.
Arnamoy B via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 9 11:51:08 PDT 2021
arnamoy10 created this revision.
arnamoy10 added reviewers: kiranchandramohan, bryanpkc, kiranktp, SouraVX, clementval, AMDChirag.
arnamoy10 added projects: Flang, OpenMP.
Herald added subscribers: jdoerfert, guansong, yaxunl.
arnamoy10 requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, sstefan1.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D100222
Files:
flang/lib/Semantics/check-omp-structure.cpp
flang/test/Semantics/omp-ordered-simd.f90
Index: flang/test/Semantics/omp-ordered-simd.f90
===================================================================
--- flang/test/Semantics/omp-ordered-simd.f90
+++ flang/test/Semantics/omp-ordered-simd.f90
@@ -92,4 +92,54 @@
END DO
!$OMP END TASKLOOP
+ !$OMP CRITICAL
+ C = C - A * B
+ !$OMP MASTER
+ DO I = 1,N
+ !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region.
+ !$OMP ORDERED
+ CALL WORK(I)
+ !$OMP END ORDERED
+ END DO
+ !$OMP END MASTER
+ !$OMP END CRITICAL
+
+ !$OMP ORDERED
+ C = C - A * B
+ !$OMP MASTER
+ DO I = 1,N
+ !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region.
+ !$OMP ORDERED
+ CALL WORK(I)
+ !$OMP END ORDERED
+ END DO
+ !$OMP END MASTER
+ !$OMP END ORDERED
+
+ !$OMP TASK
+ C = C - A * B
+ !$OMP MASTER
+ DO I = 1,N
+ !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region.
+ !$OMP ORDERED
+ CALL WORK(I)
+ !$OMP END ORDERED
+ END DO
+ !$OMP END MASTER
+ !$OMP END TASK
+
+ !$OMP TASKLOOP
+ DO J= 1,N
+ C = C - A * B
+ !$OMP MASTER
+ DO I = 1,N
+ !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region.
+ !$OMP ORDERED
+ CALL WORK(I)
+ !$OMP END ORDERED
+ END DO
+ !$OMP END MASTER
+ END DO
+ !$OMP END TASKLOOP
+
END SUBROUTINE ORDERED_BAD
Index: flang/lib/Semantics/check-omp-structure.cpp
===================================================================
--- flang/lib/Semantics/check-omp-structure.cpp
+++ flang/lib/Semantics/check-omp-structure.cpp
@@ -394,8 +394,7 @@
}
// Other disallowed nestings, these directives do not support
// ordered clause in them, so no need to check
- else if (llvm::omp::nestedOrderedErrSet.test(
- GetContextParent().directive)) {
+ else if (IsCloselyNestedRegion(llvm::omp::nestedOrderedErrSet)) {
context_.Say(blkDirective.source,
"`ORDERED` region may not be closely nested inside of "
"`CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region."_err_en_US);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100222.336534.patch
Type: text/x-patch
Size: 2343 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210409/f87585f3/attachment.bin>
More information about the llvm-commits
mailing list