[llvm-commits] [llvm] r165951 - /llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp

Rafael Espindola rafael.espindola at gmail.com
Mon Oct 15 11:21:07 PDT 2012


Author: rafael
Date: Mon Oct 15 13:21:07 2012
New Revision: 165951

URL: http://llvm.org/viewvc/llvm-project?rev=165951&view=rev
Log:
Make sure we iterate over newly created instructions. Fixes pr13625. Testcase to
follow in one sec.

Modified:
    llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp

Modified: llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp?rev=165951&r1=165950&r2=165951&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp (original)
+++ llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp Mon Oct 15 13:21:07 2012
@@ -527,6 +527,11 @@
         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);
       }





More information about the llvm-commits mailing list