[flang-commits] [flang] [flang][OpenMP] Hoist reduction info from nested `loop` ops to parent `teams` ops (PR #132003)

Michael Klemm via flang-commits flang-commits at lists.llvm.org
Fri Mar 21 11:26:45 PDT 2025


mjklemm wrote:

> I am wondering, howerver, what we should do in these 2 scearios:
> 
> ```fortran
> subroutine scenario_1
>   implicit none
>   integer :: x, i
> 
>   !$omp loop reduction(+: x) bind(teams)
>   DO i = 1, 5
>     call foo()
>   END DO
> end subroutine
> ```

I do not see how we could possibly attach the reduction to the `teams` directive.  It may be somewhere.  And I would not read the specification that way.  Because the section on combined constructs mandates the extension to both leaves, `teams` and `loop`.  But we do not have a combined construct here, so no further action needed.

A similar case would be `do reduction(+:sum)` on an orphaned `parallel` region.  Simply does not work.


https://github.com/llvm/llvm-project/pull/132003


More information about the flang-commits mailing list