[flang-commits] [flang] [llvm] [OpenMPIRBuilder] Clear the debug location when emitting reduction helpers (PR #211395)
Spencer Bryngelson via flang-commits
flang-commits at lists.llvm.org
Thu Jul 23 05:30:11 PDT 2026
sbryngelson wrote:
Thanks, I hadn't found #147950. Confirmed it went in and was reverted by #150832, and `main` currently has no `SetCurrentDebugLocation(DebugLoc())` in OMPIRBuilder.cpp, so the bug is still live.
I've narrowed this PR to just the two device helpers that cause #211385 (`emitShuffleAndReduceFunction`, `emitInterWarpCopyFunction`) and switched to `InsertPointGuard` as you did. My first version cleared the location without a guard, which leaks it to the caller since `restoreIP` does not restore the debug location.
On the clang failures that blocked your reland: only 6 clang tests reference these two helpers and none of them enable debug info, so the debug location change alone cannot move their output. Your patch also added guards to functions that previously left the insertion point moved, and I suspect that is where the failures came from rather than the debug locations. Might be worth checking before you reland.
Verified locally: the new test fails without the patch and passes with it, and flang lit is clean (582 passed, the one failure needs `fir-opt`, which my build config does not produce).
Happy to close this if you would rather land the full version. Otherwise this is the narrow fix for the flang crash and yours can supersede it.
https://github.com/llvm/llvm-project/pull/211395
More information about the flang-commits
mailing list