[all-commits] [llvm/llvm-project] d56c06: [flang][debug] Generate DISubprogramAttr for omp::...
Abid Qadeer via All-commits
all-commits at lists.llvm.org
Thu Jul 3 02:38:50 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d56c06e6c9f0cf03d75fd755c099a6844ecf38e6
https://github.com/llvm/llvm-project/commit/d56c06e6c9f0cf03d75fd755c099a6844ecf38e6
Author: Abid Qadeer <haqadeer at amd.com>
Date: 2025-07-03 (Thu, 03 Jul 2025)
Changed paths:
M flang/lib/Optimizer/Transforms/AddDebugInfo.cpp
A flang/test/Transforms/debug-omp-target-op-1.fir
A flang/test/Transforms/debug-omp-target-op-2.fir
M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
A mlir/test/Target/LLVMIR/omptarget-debug-empty.mlir
M mlir/test/Target/LLVMIR/omptarget-debug-loop-loc.mlir
M mlir/test/Target/LLVMIR/omptarget-debug-map-link-loc.mlir
M mlir/test/Target/LLVMIR/omptarget-debug-nowait.mlir
M mlir/test/Target/LLVMIR/omptarget-debug-var-1.mlir
M mlir/test/Target/LLVMIR/omptarget-debug-var-2.mlir
M mlir/test/Target/LLVMIR/omptarget-debug.mlir
M mlir/test/Target/LLVMIR/omptarget-debug2.mlir
M mlir/test/Target/LLVMIR/omptarget-parallel-llvm-debug.mlir
Log Message:
-----------
[flang][debug] Generate DISubprogramAttr for omp::TargetOp. (#146532)
This is combination of https://github.com/llvm/llvm-project/pull/138149
and https://github.com/llvm/llvm-project/pull/138039 which were opened
separately for ease of reviewing. Only other change is adjustments in 2
tests which have gone in since.
There are `DeclareOp` present for the variables mapped into target
region. That allow us to generate debug information for them. But the
`TargetOp` is still part of parent function and those variables get the
parent function's `DISubprogram` as a scope.
In `OMPIRBuilder`, a new function is created for the `TargetOp`. We also
create a new `DISubprogram` for it. All the variables that were in the
target region now have to be updated to have the correct scope. This
after the fact updating of
debug information becomes very difficult in certain cases. Take the
example of variable arrays. The type of those arrays depend on the
artificial `DILocalVariable`(s) which hold the size(s) of the array.
This new function will now require that we generate the new variable and
and new types. Similar issue exist for character type variables too.
To avoid this after the fact updating, this PR generates a
`DISubprogramAttr` for the `TargetOp` while generating the debug info in
`flang`. Then we don't need to generate a `DISubprogram` in
`OMPIRBuilder`. This change is made a bit more complicated by the the
fact that in new scheme, the debug location already points to the new
`DISubprogram` by the time it reaches `convertOmpTarget`. But we need
some code generation in the parent function so we have to carefully
manage the debug locations.
This fixes issue `#134991`.
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