summaryrefslogtreecommitdiff
path: root/lib/CodeGen/PeepholeOptimizer.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-10-15 18:21:07 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-10-15 18:21:07 +0000
commit10ad98bbbb00d67d4272e8f29186a65e2a75215e (patch)
tree92e4e36b6b135357801f961d11966a2cc86b5e49 /lib/CodeGen/PeepholeOptimizer.cpp
parent1e94e98b0ec44c5b04eaa8c9e7fb6d7669b3cdea (diff)
downloadllvm-10ad98bbbb00d67d4272e8f29186a65e2a75215e.tar.gz
llvm-10ad98bbbb00d67d4272e8f29186a65e2a75215e.tar.bz2
llvm-10ad98bbbb00d67d4272e8f29186a65e2a75215e.tar.xz
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
Diffstat (limited to 'lib/CodeGen/PeepholeOptimizer.cpp')
-rw-r--r--lib/CodeGen/PeepholeOptimizer.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/CodeGen/PeepholeOptimizer.cpp b/lib/CodeGen/PeepholeOptimizer.cpp
index 9099862bd3..a795ac8448 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);
}