When a priority_queue is empty, the behavior of top() operator is
authorEvan Cheng <evan.cheng@apple.com>
Tue, 30 May 2006 18:04:34 +0000 (18:04 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 30 May 2006 18:04:34 +0000 (18:04 +0000)
non-deterministic. Returns NULL when it's empty!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28560 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp

index c9aa18a342ef60267a432ad3b6e2b9b8b91c4eaf..ad8ed5aaf978e7704f5516f2f3a087858df141d6 100644 (file)
@@ -356,6 +356,7 @@ public:
     }
     
     SUnit *pop() {
+      if (empty()) return NULL;
       SUnit *V = Queue.top();
       Queue.pop();
       return V;