diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2008-02-11 08:30:52 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2008-02-11 08:30:52 +0000 |
| commit | ad4d57a2f5f45aca7e19b2def40979fd28644818 (patch) | |
| tree | f2a565cbabd6def12bb97b28c0ad000ef6bc96d3 /llvm/lib | |
| parent | 887f5ebfa9b2df23cbc55575efa8cf65311b2ca5 (diff) | |
| download | bcm5719-llvm-ad4d57a2f5f45aca7e19b2def40979fd28644818.tar.gz bcm5719-llvm-ad4d57a2f5f45aca7e19b2def40979fd28644818.zip | |
Determine whether a spill kills the register it's spilling before insertion rather than trying to undo the kill marker afterwards.
llvm-svn: 46953
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/RegAllocLocal.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/RegAllocLocal.cpp b/llvm/lib/CodeGen/RegAllocLocal.cpp index 12064a957c1..b14af2761c6 100644 --- a/llvm/lib/CodeGen/RegAllocLocal.cpp +++ b/llvm/lib/CodeGen/RegAllocLocal.cpp @@ -303,17 +303,12 @@ void RALocal::spillVirtReg(MachineBasicBlock &MBB, const TargetRegisterClass *RC = MF->getRegInfo().getRegClass(VirtReg); int FrameIndex = getStackSpaceFor(VirtReg, RC); DOUT << " to stack slot #" << FrameIndex; - TII->storeRegToStackSlot(MBB, I, PhysReg, true, FrameIndex, RC); - // If the instruction reads the register that's spilled, (e.g. this can // happen if it is a move to a physical register), then the spill // instruction is not a kill. - if (I != MBB.end() && I->findRegisterUseOperandIdx(PhysReg) != -1) { - MachineBasicBlock::iterator StoreMI = prior(I); - int Idx = StoreMI->findRegisterUseOperandIdx(PhysReg, true); - assert(Idx != -1 && "Unrecognized spill instruction!"); - StoreMI->getOperand(Idx).setIsKill(false); - } + bool isKill = !(I != MBB.end() && + I->findRegisterUseOperandIdx(PhysReg) != -1); + TII->storeRegToStackSlot(MBB, I, PhysReg, isKill, FrameIndex, RC); ++NumStores; // Update statistics } |

