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 @@ -849,8 +849,6 @@ void OmpStructureChecker::CheckSIMDNest(const parser::OpenMPConstruct &c) {
849849 // The only OpenMP constructs that can be encountered during execution of
850850 // a simd region are the `atomic` construct, the `loop` construct, the `simd`
851851 // construct and the `ordered` construct with the `simd` clause.
852- // TODO: Expand the check to include `LOOP` construct as well when it is
853- // supported.
854852
855853 // Check if the parent context has the SIMD clause
856854 // Please note that we use GetContext() instead of GetContextParent()
@@ -893,14 +891,15 @@ void OmpStructureChecker::CheckSIMDNest(const parser::OpenMPConstruct &c) {
893891 }
894892 }
895893 },
896- // Allowing SIMD construct
894+ // Allowing SIMD and loop construct
897895 [&](const parser::OpenMPLoopConstruct &c) {
898896 const auto &beginLoopDir{
899897 std::get<parser::OmpBeginLoopDirective>(c.t )};
900898 const auto &beginDir{
901899 std::get<parser::OmpLoopDirective>(beginLoopDir.t )};
902900 if ((beginDir.v == llvm::omp::Directive::OMPD_simd) ||
903- (beginDir.v == llvm::omp::Directive::OMPD_do_simd)) {
901+ (beginDir.v == llvm::omp::Directive::OMPD_do_simd) ||
902+ (beginDir.v == llvm::omp::Directive::OMPD_loop)) {
904903 eligibleSIMD = true ;
905904 }
906905 },
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