[llvm] [DebugInfo][SimpleLoopUnswitch] Fix missing debug location updates for new terminators (PR #98789)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 15 03:03:13 PDT 2024
================
@@ -667,9 +668,11 @@ static bool unswitchTrivialBranch(Loop &L, BranchInst &BI, DominatorTree &DT,
if (FullUnswitch) {
if (MSSAU) {
// Remove the cloned branch instruction.
- ParentBB->getTerminator()->eraseFromParent();
+ Instruction *Term = ParentBB->getTerminator();
+ Term->eraseFromParent();
----------------
SLTozer wrote:
I believe `eraseFromParent` frees the instruction, so we should copy the DebugLoc (either to the new instruction or as a local variable) before erasing it.
https://github.com/llvm/llvm-project/pull/98789
More information about the llvm-commits
mailing list