diff --git a/llvm/lib/CodeGen/PostRASchedulerList.cpp b/llvm/lib/CodeGen/PostRASchedulerList.cpp --- a/llvm/lib/CodeGen/PostRASchedulerList.cpp +++ b/llvm/lib/CodeGen/PostRASchedulerList.cpp @@ -534,8 +534,13 @@ for (unsigned i = 0, e = SUnits.size(); i != e; ++i) { // It is available if it has no predecessors. if (!SUnits[i].NumPredsLeft && !SUnits[i].isAvailable) { - AvailableQueue.push(&SUnits[i]); - SUnits[i].isAvailable = true; + if (SUnits[i].getDepth() > 0) { + assert(SUnits[i].WeakPredsLeft > 0 && "Expected a weak predecessor"); + PendingQueue.push_back(&SUnits[i]); + } else { + AvailableQueue.push(&SUnits[i]); + SUnits[i].isAvailable = true; + } } }