File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -867,8 +867,6 @@ void OmpStructureChecker::CheckSIMDNest(const parser::OpenMPConstruct &c) {
867867 // The only OpenMP constructs that can be encountered during execution of
868868 // a simd region are the `atomic` construct, the `loop` construct, the `simd`
869869 // construct and the `ordered` construct with the `simd` clause.
870- // TODO: Expand the check to include `LOOP` construct as well when it is
871- // supported.
872870
873871 // Check if the parent context has the SIMD clause
874872 // Please note that we use GetContext() instead of GetContextParent()
@@ -911,14 +909,15 @@ void OmpStructureChecker::CheckSIMDNest(const parser::OpenMPConstruct &c) {
911909 }
912910 }
913911 },
914- // Allowing SIMD construct
912+ // Allowing SIMD and loop construct
915913 [&](const parser::OpenMPLoopConstruct &c) {
916914 const auto &beginLoopDir{
917915 std::get<parser::OmpBeginLoopDirective>(c.t )};
918916 const auto &beginDir{
919917 std::get<parser::OmpLoopDirective>(beginLoopDir.t )};
920918 if ((beginDir.v == llvm::omp::Directive::OMPD_simd) ||
921- (beginDir.v == llvm::omp::Directive::OMPD_do_simd)) {
919+ (beginDir.v == llvm::omp::Directive::OMPD_do_simd) ||
920+ (beginDir.v == llvm::omp::Directive::OMPD_loop)) {
922921 eligibleSIMD = true ;
923922 }
924923 },
Original file line number Diff line number Diff line change @@ -189,3 +189,18 @@ SUBROUTINE NESTED_BAD(N)
189189
190190
191191END SUBROUTINE NESTED_BAD
192+
193+ SUBROUTINE SIMD_LOOP (A , B , N )
194+ REAL :: A(100 ), B(100 )
195+ INTEGER :: I, J, N
196+
197+ ! $OMP SIMD
198+ DO I = 1 , N
199+ ! $OMP LOOP
200+ DO J = 1 , N
201+ B(J) = B(J) + A(J)
202+ END DO
203+ ! $OMP END LOOP
204+ END DO
205+ ! $OMP END SIMD
206+ END SUBROUTINE
You can’t perform that action at this time.
0 commit comments