- 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->readsRegister(PhysReg));
+ TII->storeRegToStackSlot(MBB, I, PhysReg, isKill, FrameIndex, RC);