misched: avoid scheduling an instruction twice.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165416 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andrew Trick
2012-10-08 18:53:53 +00:00
parent cd585084e5
commit 30c6ec2199

View File

@@ -495,6 +495,7 @@ void ScheduleDAGMI::schedule() {
bool IsTopNode = false; bool IsTopNode = false;
while (SUnit *SU = SchedImpl->pickNode(IsTopNode)) { while (SUnit *SU = SchedImpl->pickNode(IsTopNode)) {
assert(!SU->isScheduled && "Node already scheduled");
if (!checkSchedLimit()) if (!checkSchedLimit())
break; break;
@@ -1119,33 +1120,36 @@ SUnit *ConvergingScheduler::pickNode(bool &IsTopNode) {
return NULL; return NULL;
} }
SUnit *SU; SUnit *SU;
if (ForceTopDown) { do {
SU = Top.pickOnlyChoice(); if (ForceTopDown) {
if (!SU) { SU = Top.pickOnlyChoice();
SchedCandidate TopCand; if (!SU) {
CandResult TopResult = SchedCandidate TopCand;
pickNodeFromQueue(Top.Available, DAG->getTopRPTracker(), TopCand); CandResult TopResult =
assert(TopResult != NoCand && "failed to find the first candidate"); pickNodeFromQueue(Top.Available, DAG->getTopRPTracker(), TopCand);
(void)TopResult; assert(TopResult != NoCand && "failed to find the first candidate");
SU = TopCand.SU; (void)TopResult;
SU = TopCand.SU;
}
IsTopNode = true;
} }
IsTopNode = true; else if (ForceBottomUp) {
} SU = Bot.pickOnlyChoice();
else if (ForceBottomUp) { if (!SU) {
SU = Bot.pickOnlyChoice(); SchedCandidate BotCand;
if (!SU) { CandResult BotResult =
SchedCandidate BotCand; pickNodeFromQueue(Bot.Available, DAG->getBotRPTracker(), BotCand);
CandResult BotResult = assert(BotResult != NoCand && "failed to find the first candidate");
pickNodeFromQueue(Bot.Available, DAG->getBotRPTracker(), BotCand); (void)BotResult;
assert(BotResult != NoCand && "failed to find the first candidate"); SU = BotCand.SU;
(void)BotResult; }
SU = BotCand.SU; IsTopNode = false;
} }
IsTopNode = false; else {
} SU = pickNodeBidrectional(IsTopNode);
else { }
SU = pickNodeBidrectional(IsTopNode); } while (SU->isScheduled);
}
if (SU->isTopReady()) if (SU->isTopReady())
Top.removeReady(SU); Top.removeReady(SU);
if (SU->isBottomReady()) if (SU->isBottomReady())