llvm-project/flang/test/Lower/OpenMP/nested-loop-transformation-construct02.f90
Krzysztof Parzyszek c2d659b9b8
[flang][OpenMP] Implement loop nest parser (#168884)
Previously, loop constructs were parsed in a piece-wise manner: the
begin directive, the body, and the end directive were parsed separately.
Later on in canonicalization they were all coalesced into a loop
construct. To facilitate that end-loop directives were given a special
treatment, namely they were parsed as OpenMP constructs. As a result
syntax errors caused by misplaced end-loop directives were handled
differently from those cause by misplaced non-loop end directives.

The new loop nest parser constructs the complete loop construct,
removing the need for the canonicalization step. Additionally, it is the
basis for parsing loop-sequence-associated constructs in the future.

It also removes the need for the special treatment of end-loop
directives. While this patch temporarily degrades the error messaging
for misplaced end-loop directives, it enables uniform handling of any
misplaced end-directives in the future.
2025-11-22 12:28:58 -06:00

21 lines
566 B
Fortran

! Test to ensure TODO message is emitted for unroll OpenMP 5.1 Directives when they are nested.
!RUN: not %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=51 -o - %s 2>&1 | FileCheck %s
program loop_transformation_construct
implicit none
integer, parameter :: I = 10
integer :: x
integer :: y(I)
!$omp do
!$omp unroll partial(2)
do x = 1, I
y(x) = y(x) * 5
end do
!$omp end unroll
!$omp end do
end program loop_transformation_construct
!CHECK: not yet implemented: Applying a loop-associated on the loop generated by the unroll construct