Make sure we iterate over newly created instructions. Fixes pr13625. Testcase to

follow in one sec.

llvm-svn: 165951
This commit is contained in:
Rafael Espindola 2012-10-15 18:21:07 +00:00
parent 90f711da9a
commit 048405f510
1 changed files with 5 additions and 0 deletions

View File

@ -527,6 +527,11 @@ bool PeepholeOptimizer::runOnMachineFunction(MachineFunction &MF) {
SeenMoveImm = true;
} else {
Changed |= optimizeExtInstr(MI, MBB, LocalMIs);
// optimizeExtInstr might have created new instructions after MI
// and before the already incremented MII. Adjust MII so that the
// next iteration sees the new instructions.
MII = MI;
++MII;
if (SeenMoveImm)
Changed |= foldImmediate(MI, MBB, ImmDefRegs, ImmDefMIs);
}