diff options
| author | Abid Qadeer <haqadeer@amd.com> | 2026-01-21 13:40:01 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-21 13:40:01 +0000 |
| commit | 7a74e7fba33c8e016c79f0b4fa55ed908061019f (patch) | |
| tree | c60e511de727cedf9ebaec011ea21a0319d68f48 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
| parent | 10aca26ffffe6a9ee049f479ed7fee9e07421dad (diff) | |
| download | llvm-7a74e7fba33c8e016c79f0b4fa55ed908061019f.zip llvm-7a74e7fba33c8e016c79f0b4fa55ed908061019f.tar.gz llvm-7a74e7fba33c8e016c79f0b4fa55ed908061019f.tar.bz2 | |
[flang][OpenMP] Fix mapping of constant arrays. (#176763)
The compiler skips mapping of named constants (parameters) to OpenMP
target regions under the assumption that constants don't need to be
mapped. This assumption is not valid when array is accessed inside with
dynamic index. The problem can be seen with the following code:
```
module fir_lowering_check
implicit none
integer, parameter :: dp = selected_real_kind(15, 307)
real(dp), parameter :: arrays(2) = (/ 0.0, 0.0 /)
contains
subroutine test(hold)
integer, intent(in) :: hold
integer :: z
real(dp) :: temp
!$omp target teams distribute parallel do
do z = 1, 2
temp = arrays(hold)
end do
!$omp end target teams distribute parallel do
end subroutine test
end module fir_lowering_check
program main
use fir_lowering_check
implicit none
integer :: hold
hold = 1
call test(hold)
print *, "Finished"
end program main
```
It fails with the following error
`'hlfir.designate' op using value defined outside the region`
The fix is to allow mapping of constant arrays and map them as `to`.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions
