summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit048405f510d873b3987bf65bcd5718f275193784 (patch)
treeac4ed6b11aa58832b11fa44dd0ccf82f0efabf33 /llvm/lib/CodeGen/PeepholeOptimizer.cpp
parent90f711da9aacbbdeda71fb5f4eed5b4fe46d4cc6 (diff)
downloadbcm5719-llvm-048405f510d873b3987bf65bcd5718f275193784.tar.gz
bcm5719-llvm-048405f510d873b3987bf65bcd5718f275193784.zip
Make sure we iterate over newly created instructions. Fixes pr13625. Testcase to
follow in one sec. llvm-svn: 165951
Diffstat (limited to 'llvm/lib/CodeGen/PeepholeOptimizer.cpp')
-rw-r--r--llvm/lib/CodeGen/PeepholeOptimizer.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/PeepholeOptimizer.cpp b/llvm/lib/CodeGen/PeepholeOptimizer.cpp
index 9099862bd31..a795ac8448f 100644
--- a/llvm/lib/CodeGen/PeepholeOptimizer.cpp
+++ b/llvm/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);
}
OpenPOWER on IntegriCloud