[flang] Inline hlfir.assign loops can make source breakpoints hit once per array element
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
When `InlineHLFIRAssign` expands an `hlfir.assign` into an inline `fir.do_loop`, the generated loop operations can inherit the assignment source location. With debug info enabled, this can make a line breakpoint on a statement like `arr = 11` stop once per array element instead of once.
Reproducer:
```fortran
program p
integer :: arr(4)
arr = 11
print *, arr
end
```
Before #201774, this was visible for plain host `flang -g -O0`: the scalar-to-array assignment was inlined, and the generated loop/store operations carried the assignment location.
PR #201774 restores the plain host `-O0` behavior by restricting that `-O0` inlining path to OpenMP target-device compilation. However, the underlying debug-location issue may still apply to other paths that intentionally inline assignment loops, such as target-device `-O0` or optimized host lowering.
A proper fix likely needs the inline assignment-loop generation path, for example `hlfir::genNoAliasArrayAssignment`, to use debug locations that do not cause per-element source breakpoint stops.
Contributor guide
Assessment
This issue has not been assessed yet.