aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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
commit1ce062fe567a08678d20149781c5e308e03d7d83 (patch)
treed2ca9622569ed3f22f7e6d40884b0bbeb130fa49 /lib
parent0b0d899f917d4771c940e7fa92990d981822a6db (diff)
downloadexternal_llvm-1ce062fe567a08678d20149781c5e308e03d7d83.zip
external_llvm-1ce062fe567a08678d20149781c5e308e03d7d83.tar.gz
external_llvm-1ce062fe567a08678d20149781c5e308e03d7d83.tar.bz2
misched: obvious iterator update fixes for bottom-up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153160 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/MachineScheduler.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineScheduler.cpp b/lib/CodeGen/MachineScheduler.cpp
index 9f67d6d..57ae6dc 100644
--- a/lib/CodeGen/MachineScheduler.cpp
+++ b/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;
}