[flang-commits] [flang] [flang][OpenMP] Support ALLOCATABLE list items in LINEAR (PR #228827)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Mon Oct 12 09:01:36 PDT 2026
https://github.com/tblah commented:
This is great progress.
I think we need the more complete integration discussed in your plan (with dialect changes) to avoid these extra copies. Other than performance concerns, the copy changes results for a program like this (written by AI):
```
program p
implicit none
integer, allocatable :: i
integer :: seen(3), k
allocate(i)
i = 42
seen = -1
k = 1
!$omp simd linear(i:2) linear(k)
do i = 1, 5, 2
seen(k) = i
k = k + 1
end do
!$omp end simd
print *, seen, i
if (any(seen /= [1, 3, 5])) stop 1
if (i /= 7) stop 2
end
```
The new copy in means that i gets values starting at 42 instead of being initialized to 1. This is because the copy happens inside the loop body instead of before it. So I think this should be handled in translation.
That also makes things simpler for other users of the dialect: the linear clause should stand on its own without also requiring separate privatization.
https://github.com/llvm/llvm-project/pull/228827
More information about the flang-commits
mailing list