diff options
author | Jim Grosbach <grosbach@apple.com> | 2009-10-14 21:22:39 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2009-10-14 21:22:39 +0000 |
commit | 33524c3b26e3b709488d84094493d9a6098c0155 (patch) | |
tree | 207d81bf8537e5d5a26e09dc7bced380be09a5ea /lib/CodeGen/PrologEpilogInserter.cpp | |
parent | c90aefe95ec5fd028782788620ab7d6fd73593f3 (diff) | |
download | external_llvm-33524c3b26e3b709488d84094493d9a6098c0155.zip external_llvm-33524c3b26e3b709488d84094493d9a6098c0155.tar.gz external_llvm-33524c3b26e3b709488d84094493d9a6098c0155.tar.bz2 |
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
Diffstat (limited to 'lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r-- | lib/CodeGen/PrologEpilogInserter.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp index 74cc18b..7af0bba 100644 --- a/lib/CodeGen/PrologEpilogInserter.cpp +++ b/lib/CodeGen/PrologEpilogInserter.cpp @@ -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 |