From: Misha Brukman Date: Wed, 4 Dec 2002 19:24:45 +0000 (+0000) Subject: Fun arithmetic with iterators aimed at fixing a bug: inserting instructions X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=06f8aecc882b90d23206233fe95b2df6078f987c;p=oota-llvm.git Fun arithmetic with iterators aimed at fixing a bug: inserting instructions after the *current* instruction while keeping the iterator in the same 'logical' place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4923 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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); }