[llvm-commits] [llvm] r153160 - /llvm/trunk/lib/CodeGen/MachineScheduler.cpp

Andrew Trick atrick at apple.com
Tue Mar 20 21:12:10 PDT 2012


Author: atrick
Date: Tue Mar 20 23:12:10 2012
New Revision: 153160

URL: http://llvm.org/viewvc/llvm-project?rev=153160&view=rev
Log:
misched: obvious iterator update fixes for bottom-up.

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

Modified: llvm/trunk/lib/CodeGen/MachineScheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineScheduler.cpp?rev=153160&r1=153159&r2=153160&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineScheduler.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineScheduler.cpp Tue Mar 20 23:12:10 2012
@@ -369,8 +369,12 @@
 
 void ScheduleDAGMI::moveInstruction(MachineInstr *MI,
                                     MachineBasicBlock::iterator InsertPos) {
+  // Fix RegionBegin if the first instruction moves down.
+  if (&*RegionBegin == MI)
+    RegionBegin = llvm::next(RegionBegin);
   BB->splice(InsertPos, BB, MI);
   LIS->handleMove(MI);
+  // Fix RegionBegin if another instruction moves above the first instruction.
   if (RegionBegin == InsertPos)
     RegionBegin = MI;
 }
@@ -440,6 +444,8 @@
       if (&*llvm::prior(CurrentBottom) == MI)
         --CurrentBottom;
       else {
+        if (&*CurrentTop == MI)
+          CurrentTop = llvm::next(CurrentTop);
         moveInstruction(MI, CurrentBottom);
         CurrentBottom = MI;
       }





More information about the llvm-commits mailing list