diff options
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/ARM/ARMBaseInstrInfo.cpp | 7 | ||||
-rw-r--r-- | lib/Target/ARM/ARMBaseInstrInfo.h | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/Target/ARM/ARMBaseInstrInfo.cpp b/lib/Target/ARM/ARMBaseInstrInfo.cpp index e7024d6..142633c 100644 --- a/lib/Target/ARM/ARMBaseInstrInfo.cpp +++ b/lib/Target/ARM/ARMBaseInstrInfo.cpp @@ -1378,9 +1378,11 @@ AnalyzeCompare(const MachineInstr *MI, unsigned &SrcReg, int &CmpValue) const { } /// ConvertToSetZeroFlag - Convert the instruction to set the "zero" flag so -/// that we can remove a "comparison with zero". +/// that we can remove a "comparison with zero". Update the iterator *only* if a +/// transformation took place. bool ARMBaseInstrInfo:: -ConvertToSetZeroFlag(MachineInstr *MI, MachineInstr *CmpInstr) const { +ConvertToSetZeroFlag(MachineInstr *MI, MachineInstr *CmpInstr, + MachineBasicBlock::iterator &MII) const { // Conservatively refuse to convert an instruction which isn't in the same BB // as the comparison. if (MI->getParent() != CmpInstr->getParent()) @@ -1414,6 +1416,7 @@ ConvertToSetZeroFlag(MachineInstr *MI, MachineInstr *CmpInstr) const { MI->RemoveOperand(5); MachineInstrBuilder(MI) .addReg(ARM::CPSR, RegState::Define | RegState::Implicit); + MII = llvm::next(MachineBasicBlock::iterator(CmpInstr)); CmpInstr->eraseFromParent(); return true; } diff --git a/lib/Target/ARM/ARMBaseInstrInfo.h b/lib/Target/ARM/ARMBaseInstrInfo.h index f471b67..622402e 100644 --- a/lib/Target/ARM/ARMBaseInstrInfo.h +++ b/lib/Target/ARM/ARMBaseInstrInfo.h @@ -347,7 +347,8 @@ public: /// ConvertToSetZeroFlag - Convert the instruction to set the zero flag so /// that we can remove a "comparison with zero". virtual bool ConvertToSetZeroFlag(MachineInstr *Instr, - MachineInstr *CmpInstr) const; + MachineInstr *CmpInstr, + MachineBasicBlock::iterator &MII) const; virtual unsigned getNumMicroOps(const MachineInstr *MI, const InstrItineraryData *ItinData) const; |