[clang] [llvm] [IRBuilder] Improve setting of DebugLoc in SetInsertPoint. (PR #147091)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 16 03:36:41 PDT 2025
SLTozer wrote:
I 'm not sure I agree with the principle of this change; the current behaviour of not getting a DebugLoc when setting the insertion point to the end of a BasicBlock is long-standing and this change might have unexpected knock-on effects (although if we do make this change, it must also be extended to the `setInsertPoint(BasicBlock*)` version of this function to avoid a confusing difference). I think the more reasonable version of this change would be to save and restore the old debug location explicitly - the RAII version of this pattern, `llvm::InsertPointGuard`, has this behaviour. Updating the `InsertPoint` class and every consumer of its API would be onerous, but has less risk of introducing surprising results; modifying just the code that causes #147063 to save and restore a debug location would be preferable to this, at least imo. I'm open to changing my mind if there's a good argument that this behaviour is correct in principle, however.
https://github.com/llvm/llvm-project/pull/147091
More information about the llvm-commits
mailing list