[all-commits] [llvm/llvm-project] 006037: [mlir][OpenMP] Use correct debug location with lin...

Abid Qadeer via All-commits all-commits at lists.llvm.org
Wed Jun 25 05:50:01 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 006037675c10b20d33a2a3c273bf3cdb8b0a252c
      https://github.com/llvm/llvm-project/commit/006037675c10b20d33a2a3c273bf3cdb8b0a252c
  Author: Abid Qadeer <haqadeer at amd.com>
  Date:   2025-06-25 (Wed, 25 Jun 2025)

  Changed paths:
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    A mlir/test/Target/LLVMIR/omptarget-debug-map-link-loc.mlir

  Log Message:
  -----------
  [mlir][OpenMP] Use correct debug location with link clause. (#145026)

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
```

When compiled with
`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 caused an invalid location to be attached
to the instruction.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list