[flang] Inline hlfir.assign loops can make source breakpoints hit once per array element
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:
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.
@llvm/issue-subscribers-debuginfo
Author: Sairudra More (Saieiei)
Reproducer:
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.
I opened #202065 to track the broader debug-location issue separately. I’m leaving it open because #201774 only restores the plain host -O0 behavior. It does not fix debug locations for all generated inline assignment loops.