diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/PHIElimination.cpp | 7 | ||||
-rw-r--r-- | lib/CodeGen/TwoAddressInstructionPass.cpp | 4 |
2 files changed, 5 insertions, 6 deletions
diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp index e0025f9e4f..06305826e8 100644 --- a/lib/CodeGen/PHIElimination.cpp +++ b/lib/CodeGen/PHIElimination.cpp @@ -20,6 +20,7 @@ #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/CFG.h" +#include "Support/STLExtras.h" namespace llvm { @@ -171,8 +172,7 @@ bool PNE::EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB) { bool HaveNotEmitted = true; if (I != opBlock.begin()) { - MachineBasicBlock::iterator PrevInst = I; - --PrevInst; + MachineBasicBlock::iterator PrevInst = prior(I); for (unsigned i = 0, e = PrevInst->getNumOperands(); i != e; ++i) { MachineOperand &MO = PrevInst->getOperand(i); if (MO.isRegister() && MO.getReg() == IncomingReg) @@ -253,8 +253,7 @@ bool PNE::EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB) { // kills the incoming value! // if (!ValueIsLive) { - MachineBasicBlock::iterator Prev = I; - --Prev; + MachineBasicBlock::iterator Prev = prior(I); LV->addVirtualRegisterKilled(SrcReg, &opBlock, Prev); } } diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp index 8dc2ffe365..6f1e990140 100644 --- a/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -38,6 +38,7 @@ #include "llvm/Target/TargetMachine.h" #include "Support/Debug.h" #include "Support/Statistic.h" +#include "Support/STLExtras.h" #include <iostream> using namespace llvm; @@ -134,8 +135,7 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) { unsigned Added = MRI.copyRegToReg(*mbbi, mi, regA, regB, rc); numInstrsAdded += Added; - MachineBasicBlock::iterator prevMi = mi; - --prevMi; + MachineBasicBlock::iterator prevMi = prior(mi); DEBUG(std::cerr << "\t\tadded instruction: "; prevMi->print(std::cerr, TM)); |