Skip to content

Commit

Permalink
[RegAllocFast] Handle new debug values for spills
Browse files Browse the repository at this point in the history
These new debug values get inserted after the place where the spill
happens, which means they won't be reached by the reverse traversal of
basic block instructions. This would crash or fail assertions if they
contained any virtual registers to be replaced. We can manually handle
the new debug values right away to resolve this.

Fixes llvm/llvm-project#59172

Reviewed By: StephenTozer

Differential Revision: https://reviews.llvm.org/D139590

(cherry picked from commit 87f57f4)
  • Loading branch information
cuviper authored and tstellar committed Jan 12, 2023
1 parent 1095870 commit 948cadd
Show file tree
Hide file tree
Showing 2 changed files with 253 additions and 0 deletions.
3 changes: 3 additions & 0 deletions llvm/lib/CodeGen/RegAllocFast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,9 @@ void RegAllocFast::spill(MachineBasicBlock::iterator Before, Register VirtReg,
SpilledOperandsMap[MO->getParent()].push_back(MO);
for (auto MISpilledOperands : SpilledOperandsMap) {
MachineInstr &DBG = *MISpilledOperands.first;
// We don't have enough support for tracking operands of DBG_VALUE_LISTs.
if (DBG.isDebugValueList())
continue;
MachineInstr *NewDV = buildDbgValueForSpill(
*MBB, Before, *MISpilledOperands.first, FI, MISpilledOperands.second);
assert(NewDV->getParent() == MBB && "dangling parent pointer");
Expand Down
Loading

0 comments on commit 948cadd

Please sign in to comment.