[llvm-commits] [llvm] r157003 - /llvm/trunk/lib/CodeGen/MachineScheduler.cpp
Andrew Trick
atrick at apple.com
Thu May 17 11:35:03 PDT 2012
Author: atrick
Date: Thu May 17 13:35:03 2012
New Revision: 157003
URL: http://llvm.org/viewvc/llvm-project?rev=157003&view=rev
Log:
misched: fix liveness iterators
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=157003&r1=157002&r2=157003&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineScheduler.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineScheduler.cpp Thu May 17 13:35:03 2012
@@ -149,7 +149,7 @@
/// non-debug instruction.
static MachineBasicBlock::iterator
nextIfDebug(MachineBasicBlock::iterator I, MachineBasicBlock::iterator End) {
- while(I != End) {
+ for(; I != End; ++I) {
if (!I->isDebugValue())
break;
}
@@ -449,17 +449,19 @@
void ScheduleDAGMI::moveInstruction(MachineInstr *MI,
MachineBasicBlock::iterator InsertPos) {
- // Fix RegionBegin if the first instruction moves down.
+ // Advance RegionBegin if the first instruction moves down.
if (&*RegionBegin == MI)
- RegionBegin = llvm::next(RegionBegin);
+ ++RegionBegin;
+
+ // Update the instruction stream.
BB->splice(InsertPos, BB, MI);
+
+ // Update LiveIntervals
LIS->handleMove(MI);
- // Fix RegionBegin if another instruction moves above the first instruction.
+
+ // Recede RegionBegin if an instruction moves above the first.
if (RegionBegin == InsertPos)
RegionBegin = MI;
- // Fix TopRPTracker if we move something above CurrentTop.
- if (CurrentTop == InsertPos)
- TopRPTracker.setPos(MI);
}
bool ScheduleDAGMI::checkSchedLimit() {
@@ -571,8 +573,10 @@
assert(SU->isTopReady() && "node still has unscheduled dependencies");
if (&*CurrentTop == MI)
CurrentTop = nextIfDebug(++CurrentTop, CurrentBottom);
- else
+ else {
moveInstruction(MI, CurrentTop);
+ TopRPTracker.setPos(MI);
+ }
// Update top scheduled pressure.
TopRPTracker.advance();
@@ -588,8 +592,10 @@
if (&*priorII == MI)
CurrentBottom = priorII;
else {
- if (&*CurrentTop == MI)
- CurrentTop = nextIfDebug(++CurrentTop, CurrentBottom);
+ if (&*CurrentTop == MI) {
+ CurrentTop = nextIfDebug(++CurrentTop, priorII);
+ TopRPTracker.setPos(CurrentTop);
+ }
moveInstruction(MI, CurrentBottom);
CurrentBottom = MI;
}
More information about the llvm-commits
mailing list