Make loop not recalc getNumOperands() each time around

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84138 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach 2009-10-14 21:22:39 +00:00
parent c90aefe95e
commit 33524c3b26

View File

@ -778,9 +778,7 @@ void PEI::scavengeFrameVirtualRegs(MachineFunction &Fn) {
// directly.
for (MachineBasicBlock::iterator I = BB->begin(); I != BB->end(); ++I) {
MachineInstr *MI = I;
// Likewise, call getNumOperands() each iteration, as the MI may change
// inside the loop (with 'i' updated accordingly).
for (unsigned i = 0; i != MI->getNumOperands(); ++i)
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i)
if (MI->getOperand(i).isReg()) {
MachineOperand &MO = MI->getOperand(i);
unsigned Reg = MO.getReg();
@ -853,6 +851,7 @@ void PEI::scavengeFrameVirtualRegs(MachineFunction &Fn) {
// just calculating the value we already have.
BB->erase(I, LastUseMI);
MI = I = LastUseMI;
e = MI->getNumOperands();
CurrentScratchReg = PrevScratchReg;
// Extend the live range of the register