llvm-project/flang/test/Lower/OpenMP/nested-loop-transformation-construct02.f90
Michael Kruse b487f9a7bd
[Flang] Implement !$omp unroll using omp.unroll_heuristic (#144785)
Add support for `!$omp unroll` in Flang and basic MLIR
`omp.canonical_loop` modeling.

First step to add `omp.canonical_loop` modeling to the MLIR OpenMP
dialect with the goal of being more general than the current
`omp.loop_nest` approach:
 * Support for non-perfectly nested loops
 * Support for non-rectangular loops
 * Support for arbitrary compositions of loop transformations

This patch is functional end-to-end and adds support for `!$omp unroll`
to Flang. `!$omp unroll` is lowered to `omp.new_cli`,
`omp.canonical_loop`, and `omp.unroll_heuristic` in MLIR, which are
lowered to LLVM-IR using the OpenMPIRBuilder
(https://reviews.llvm.org/D107764).
2025-07-22 11:39:01 +02:00

21 lines
555 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
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