From 172c362fefe3d6e762ada119d4084ed4ed31595b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 4 Jan 2006 06:47:48 +0000 Subject: [PATCH] Add an assertion, update DefInst even though no one uses it (dangling pointers don't help anyone) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25081 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/PHIElimination.cpp | 4 ++++ lib/CodeGen/VirtRegMap.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp index 91805a93edf..8441e49bbc6 100644 --- a/lib/CodeGen/PHIElimination.cpp +++ b/lib/CodeGen/PHIElimination.cpp @@ -145,6 +145,10 @@ void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB, LV->addVirtualRegisterDead(DestReg, PHICopy); LV->removeVirtualRegistersDead(MPhi); } + + // Realize that the destination register is defined by the PHI copy now, not + // the PHI itself. + LV->getVarInfo(DestReg).DefInst = PHICopy; } // Adjust the VRegPHIUseCount map to account for the removal of this PHI diff --git a/lib/CodeGen/VirtRegMap.cpp b/lib/CodeGen/VirtRegMap.cpp index 26498b7ec1f..f27ae2a8212 100644 --- a/lib/CodeGen/VirtRegMap.cpp +++ b/lib/CodeGen/VirtRegMap.cpp @@ -393,6 +393,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, const VirtRegMap &VRM) { // Otherwise, reload it and remember that we have it. PhysReg = VRM.getPhys(VirtReg); + assert(PhysReg && "Must map virtreg to physreg!"); const TargetRegisterClass* RC = MBB.getParent()->getSSARegMap()->getRegClass(VirtReg);