diff options
| author | Krzysztof Parzyszek <Krzysztof.Parzyszek@amd.com> | 2025-11-22 12:28:58 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-22 12:28:58 -0600 |
| commit | c2d659b9b8efac9f80b8ebcb2b38b61295d82bdc (patch) | |
| tree | 5b03136dfe47e5301733fd117ac5d71b3ab94fcb /flang/test/Parser/OpenMP/loop-transformation-construct01.f90 | |
| parent | 216e85bdda22ae7eda3f3e04c51d9d6d82e2b617 (diff) | |
[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.
Diffstat (limited to 'flang/test/Parser/OpenMP/loop-transformation-construct01.f90')
| -rw-r--r-- | flang/test/Parser/OpenMP/loop-transformation-construct01.f90 | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/flang/test/Parser/OpenMP/loop-transformation-construct01.f90 b/flang/test/Parser/OpenMP/loop-transformation-construct01.f90 index 8b314d8d823d..979dd0c57e8b 100644 --- a/flang/test/Parser/OpenMP/loop-transformation-construct01.f90 +++ b/flang/test/Parser/OpenMP/loop-transformation-construct01.f90 @@ -10,7 +10,7 @@ subroutine loop_transformation_construct integer :: y(I) !$omp do - !$omp unroll + !$omp unroll partial(1) do i = 1, I y(i) = y(i) * 5 end do @@ -28,7 +28,8 @@ end subroutine !CHECK-PARSE-NEXT: | | | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPLoopConstruct !CHECK-PARSE-NEXT: | | | | | OmpBeginLoopDirective !CHECK-PARSE-NEXT: | | | | | | OmpDirectiveName -> llvm::omp::Directive = unroll -!CHECK-PARSE-NEXT: | | | | | | OmpClauseList -> +!CHECK-PARSE-NEXT: | | | | | | OmpClauseList -> OmpClause -> Partial -> Scalar -> Integer -> Constant -> Expr = '1_4' +!CHECK-PARSE-NEXT: | | | | | | | LiteralConstant -> IntLiteralConstant = '1' !CHECK-PARSE-NEXT: | | | | | | Flags = None !CHECK-PARSE-NEXT: | | | | | Block !CHECK-PARSE-NEXT: | | | | | | ExecutionPartConstruct -> ExecutableConstruct -> DoConstruct @@ -71,7 +72,7 @@ end subroutine !CHECK-UNPARSE-NEXT: INTEGER x !CHECK-UNPARSE-NEXT: INTEGER y(i) !CHECK-UNPARSE-NEXT: !$OMP DO -!CHECK-UNPARSE-NEXT: !$OMP UNROLL +!CHECK-UNPARSE-NEXT: !$OMP UNROLL PARTIAL(1_4) !CHECK-UNPARSE-NEXT: DO i=1_4,i !CHECK-UNPARSE-NEXT: y(int(i,kind=8))=5_4*y(int(i,kind=8)) !CHECK-UNPARSE-NEXT: END DO |
