[flang-commits] [flang] Redo [flang][OpenMP] Implement collapse for imperfectly nested loops (PR #208528)
Sairudra More via flang-commits
flang-commits at lists.llvm.org
Fri Jul 10 01:49:01 PDT 2026
https://github.com/Saieiei commented:
I reproduced a remaining target-lowering failure at the current head (`1ffd30ed`):
```fortran
subroutine repro(n, m, x)
implicit none
integer, intent(in) :: n, m
integer, intent(inout) :: x
integer :: i, j
!$omp target teams distribute parallel do collapse(2) map(tofrom:x)
do i = 1, n
do j = 1, m
x = x + 1
end do
x = x + j
end do
end subroutine
```
```text
%flang_fc1 -emit-hlfir -fopenmp repro.f90 -o -
'omp.target' op host_eval argument illegal use in 'arith.addi' operation
```
`genCollapsedLoopNestBody` uses host-evaluated loop bounds in the intervening-code guard and terminal-IV restoration (`arith.cmpi`/`arith.addi`), which the target verifier rejects. The equivalent non-target loop lowers successfully.
The `ContinueStmt` change fixes the labeled empty-loop case, but genuine intervening code under `omp.target` still fails. Could this path be handled or diagnosed as not yet supported and covered by a non-empty target regression before relanding?
https://github.com/llvm/llvm-project/pull/208528
More information about the flang-commits
mailing list