[flang-commits] [flang] [flang][OpenMP] Improve reduction of Scalar ArrayElement types (PR #163940)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Fri Oct 17 06:47:59 PDT 2025
kparzysz wrote:
> One limitation of this approach is that if the ArrayElement is not used, there is no available element in the parse tree to use to reassign the value, so its only done if used.
Correct me if I'm reading the code wrong, but it seems like you do the reassignment back to the original array only when that element is used, but you do the replacement with a scalar in all cases. If so, that will produce incorrect code:
```
subroutine foo(a, b)
integer, intent(inout) :: a(10), b(10)
integer :: i
!$omp parallel do reduction(+: a(3))
do i = 1, 10
a(3) = a(3) + b(i) ! update visible to callers of foo
end do
!$omp end parallel do
end
```
https://github.com/llvm/llvm-project/pull/163940
More information about the flang-commits
mailing list