[llvm] [DebugInfo][RemoveDIs] Support maintaining DPValues in CodeGenPrepare (PR #73660)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 08:11:57 PST 2023


jmorse wrote:

Added a bonus-patch that uses `getStableDebugLoc` instead of `getStableLoc` in `BasicBlock::splitBasicBlock`.  When we spilt blocks, the default behaviour of `splitBasicBlock` is to give the resulting branch instruction the DebugLoc from the next instruction from the split position -- however if that's a dbg.value intrinsic, then we assign a source-location that's derived from a debug-intrinsic, which is wrong. It will cause differences in the line tables between -g and -gmlt.

This is covered by the test `Transforms/CodeGenPrepare/X86/cttz-ctlz.ll`: CodeGenPrepare splits the block in each function after the call to the cttz/ctlz intrinsic, which when debugify is applied is a dbg.value intrinsic. Without this change, we get different line-numbers in dbg.value mode versus RemoveDIs mode.

https://github.com/llvm/llvm-project/pull/73660


More information about the llvm-commits mailing list