diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-08-09 22:08:24 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-08-09 22:08:24 +0000 |
commit | 69a0aa87f8d64895af082cb52c7ecee0f6021d20 (patch) | |
tree | c7751ab34bfb7c9b135ff7c3e5bfe4fa1168563d /lib/Target/Mips | |
parent | 3246176838a47fa088b98772d4899063a9b7f731 (diff) | |
download | external_llvm-69a0aa87f8d64895af082cb52c7ecee0f6021d20.zip external_llvm-69a0aa87f8d64895af082cb52c7ecee0f6021d20.tar.gz external_llvm-69a0aa87f8d64895af082cb52c7ecee0f6021d20.tar.bz2 |
Don't modify MO while use_iterator is still pointing to it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161626 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips')
-rw-r--r-- | lib/Target/Mips/MipsISelDAGToDAG.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Target/Mips/MipsISelDAGToDAG.cpp b/lib/Target/Mips/MipsISelDAGToDAG.cpp index e1d6212..5a97c17 100644 --- a/lib/Target/Mips/MipsISelDAGToDAG.cpp +++ b/lib/Target/Mips/MipsISelDAGToDAG.cpp @@ -242,13 +242,14 @@ bool MipsDAGToDAGISel::ReplaceUsesWithZeroReg(MachineRegisterInfo *MRI, // Replace uses with ZeroReg. for (MachineRegisterInfo::use_iterator U = MRI->use_begin(DstReg), - E = MRI->use_end(); U != E; ++U) { + E = MRI->use_end(); U != E;) { MachineOperand &MO = U.getOperand(); + unsigned OpNo = U.getOperandNo(); MachineInstr *MI = MO.getParent(); + ++U; // Do not replace if it is a phi's operand or is tied to def operand. - if (MI->isPHI() || MI->isRegTiedToDefOperand(U.getOperandNo()) || - MI->isPseudo()) + if (MI->isPHI() || MI->isRegTiedToDefOperand(OpNo) || MI->isPseudo()) continue; MO.setReg(ZeroReg); |