From 430b6e40abd8af80edae6be25538e49f3642f3d9 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Tue, 18 May 2010 22:20:09 +0000 Subject: Remember to update VirtRegLastUse when spilling without killing before a call. llvm-svn: 104074 --- llvm/lib/CodeGen/RegAllocLocal.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/lib/CodeGen/RegAllocLocal.cpp') diff --git a/llvm/lib/CodeGen/RegAllocLocal.cpp b/llvm/lib/CodeGen/RegAllocLocal.cpp index 8106a36c9b4..321ae12def5 100644 --- a/llvm/lib/CodeGen/RegAllocLocal.cpp +++ b/llvm/lib/CodeGen/RegAllocLocal.cpp @@ -301,6 +301,16 @@ void RALocal::storeVirtReg(MachineBasicBlock &MBB, DEBUG(dbgs() << " to stack slot #" << FrameIndex); TII->storeRegToStackSlot(MBB, I, PhysReg, isKill, FrameIndex, RC, TRI); ++NumStores; // Update statistics + + // Mark the spill instruction as last use if we're not killing the register. + if (!isKill) { + MachineInstr *Spill = llvm::prior(I); + int OpNum = Spill->findRegisterUseOperandIdx(PhysReg); + if (OpNum < 0) + getVirtRegLastUse(VirtReg) = std::make_pair((MachineInstr*)0, 0); + else + getVirtRegLastUse(VirtReg) = std::make_pair(Spill, OpNum); + } } /// spillVirtReg - This method spills the value specified by PhysReg into the -- cgit v1.2.3