diff --git a/lib/CodeGen/MachineScheduler.cpp b/lib/CodeGen/MachineScheduler.cpp index c6679c2666e..55af22920ab 100644 --- a/lib/CodeGen/MachineScheduler.cpp +++ b/lib/CodeGen/MachineScheduler.cpp @@ -643,6 +643,10 @@ struct ReadyQ { bool empty() const { return Queue.empty(); } + iterator begin() { return Queue.begin(); } + + iterator end() { return Queue.end(); } + iterator find(SUnit *SU) { return std::find(Queue.begin(), Queue.end(), SU); } @@ -705,10 +709,12 @@ public: } virtual void releaseTopNode(SUnit *SU) { - TopQueue.push(SU); + if (!SU->isScheduled) + TopQueue.push(SU); } virtual void releaseBottomNode(SUnit *SU) { - BotQueue.push(SU); + if (!SU->isScheduled) + BotQueue.push(SU); } }; } // namespace