From: Rafael Espindola Date: Mon, 15 Oct 2012 18:21:07 +0000 (+0000) Subject: Make sure we iterate over newly created instructions. Fixes pr13625. Testcase to X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=10ad98bbbb00d67d4272e8f29186a65e2a75215e;p=oota-llvm.git Make sure we iterate over newly created instructions. Fixes pr13625. Testcase to follow in one sec. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165951 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/PeepholeOptimizer.cpp b/lib/CodeGen/PeepholeOptimizer.cpp index 9099862bd31..a795ac8448f 100644 --- a/lib/CodeGen/PeepholeOptimizer.cpp +++ b/lib/CodeGen/PeepholeOptimizer.cpp @@ -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); }