From 8c8194500d3e06a7200a7a49508a6dc766d6e00a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 5 Aug 2003 04:13:58 +0000 Subject: [PATCH] Fix bugs handling ESP in alloca references git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7591 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/RegAllocLocal.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp index bf1670229ae..1b84b30f57f 100644 --- a/lib/CodeGen/RegAllocLocal.cpp +++ b/lib/CodeGen/RegAllocLocal.cpp @@ -232,7 +232,8 @@ void RA::removePhysReg(unsigned PhysReg) { /// void RA::spillVirtReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator &I, unsigned VirtReg, unsigned PhysReg) { - assert((VirtReg || DisableKill) && "Spilling a physical register is illegal!" + if (!VirtReg && DisableKill) return; + assert(VirtReg && "Spilling a physical register is illegal!" " Must not have appropriate kill for the register or use exists beyond" " the intended one."); DEBUG(std::cerr << " Spilling register " << RegInfo->getName(PhysReg); @@ -606,8 +607,10 @@ void RA::AllocateBasicBlock(MachineBasicBlock &MBB) { // Spill all physical registers holding virtual registers now. while (!PhysRegsUsed.empty()) - spillVirtReg(MBB, I, PhysRegsUsed.begin()->second, - PhysRegsUsed.begin()->first); + if (unsigned VirtReg = PhysRegsUsed.begin()->second) + spillVirtReg(MBB, I, VirtReg, PhysRegsUsed.begin()->first); + else + removePhysReg(PhysRegsUsed.begin()->first); for (std::map::iterator I = Virt2PhysRegMap.begin(), E = Virt2PhysRegMap.end(); I != E; ++I) -- 2.34.1