Commit 22d3e4f
committed
[mlir][OpenMP] Use correct debug location with link clause.
Please see the following program.
module test_0
INTEGER :: sp = 1
!$omp declare target link(sp)
end module test_0
program main
use test_0
integer :: new_len
!$omp target map(tofrom:new_len) map(tofrom:sp)
new_len = sp
!$omp end target
print *, new_len
print *, sp
end program
flang -g -O0 -fopenmp --offload-arch=gfx1100
will fail the compilation with the following error:
dbg attachment points at wrong subprogram for function
The reason is that with the link clause on !$omp declare target, an
extra load instruction is inserted. But the debug location was not
updated before insertion which cuased it to have an invalid debug
location.1 parent 775a69b commit 22d3e4f
File tree
2 files changed
+41
-0
lines changed- mlir
- lib/Target/LLVMIR/Dialect/OpenMP
- test/Target/LLVMIR
2 files changed
+41
-0
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4831 | 4831 | | |
4832 | 4832 | | |
4833 | 4833 | | |
| 4834 | + | |
4834 | 4835 | | |
4835 | 4836 | | |
4836 | 4837 | | |
| |||
4865 | 4866 | | |
4866 | 4867 | | |
4867 | 4868 | | |
| 4869 | + | |
4868 | 4870 | | |
4869 | 4871 | | |
4870 | 4872 | | |
| |||
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
0 commit comments