diff --git a/lib/CodeGen/RegAllocSimple.cpp b/lib/CodeGen/RegAllocSimple.cpp index 0daab42c3eb..596ade5faca 100644 --- a/lib/CodeGen/RegAllocSimple.cpp +++ b/lib/CodeGen/RegAllocSimple.cpp @@ -29,7 +29,8 @@ namespace { unsigned NumBytesAllocated, ByteAlignment; // Maps SSA Regs => offsets on the stack where these values are stored - std::map RegMap; // FIXME: change name to VirtReg2OffsetMap + // FIXME: change name to VirtReg2OffsetMap + std::map RegMap; // Maps SSA Regs => physical regs std::map SSA2PhysRegMap; @@ -235,7 +236,8 @@ bool RegAllocSimple::runOnMachineFunction(MachineFunction &Fn) { if (op.opIsDef()) { physReg = getFreeReg(virtualReg); MachineBasicBlock::iterator J = I; - I = saveVirtRegToStack(J, virtualReg, physReg); + J = saveVirtRegToStack(++J, virtualReg, physReg); + I = --J; } else { I = moveUseToReg(I, virtualReg, physReg); }