summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineScheduler.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-03-21 04:12:10 +0000
committerAndrew Trick <atrick@apple.com>2012-03-21 04:12:10 +0000
commit54f7def7034512546255b450a31eaecc88cce61d (patch)
tree450df2ac2c71534265d722a211926419577038ee /llvm/lib/CodeGen/MachineScheduler.cpp
parentde670c030438784284d2e0ecd3c0827406ab35ec (diff)
downloadbcm5719-llvm-54f7def7034512546255b450a31eaecc88cce61d.tar.gz
bcm5719-llvm-54f7def7034512546255b450a31eaecc88cce61d.zip
misched: obvious iterator update fixes for bottom-up.
llvm-svn: 153160
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineScheduler.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index 9f67d6d0189..57ae6dc02a4 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -369,8 +369,12 @@ void ScheduleDAGMI::releasePredecessors(SUnit *SU) {
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 @@ void ScheduleDAGMI::schedule() {
if (&*llvm::prior(CurrentBottom) == MI)
--CurrentBottom;
else {
+ if (&*CurrentTop == MI)
+ CurrentTop = llvm::next(CurrentTop);
moveInstruction(MI, CurrentBottom);
CurrentBottom = MI;
}
OpenPOWER on IntegriCloud