summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2017-11-16 10:18:07 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2017-11-16 10:18:07 +0000
commitbd20e9755f09d2e25343984481f1652c7e72f0fc (patch)
treef36e5d09217e104c5c8b5d96457710d7a6660de1 /llvm/lib/CodeGen
parent6e6d5326a13bbc6529453ffcd6d492c7b43c8eb0 (diff)
downloadbcm5719-llvm-bd20e9755f09d2e25343984481f1652c7e72f0fc.tar.gz
bcm5719-llvm-bd20e9755f09d2e25343984481f1652c7e72f0fc.zip
Assert correct removal of SUnit in LatencyPriorityQueue
The LatencyPriorityQueue doesn't currently check whether the SU being removed really exists in the Queue. This method fails quietly when SU is not found and removes the last element from the Queue, leading to unexpected behavior. Unfortunately, this only occurs on our custom target, with the custom scheduler. In our case, when remove() is invoked, it removes the wrong SU at the end of the Queue, which is only discovered later when VerifyScheduledDAG() is invoked and finds that some nodes were not scheduled at all. As this is only reproducible with a lot of proprietary code, I'm hopeful this assert is straightforward enough to not necessitate a test. Patch by Ondrej Glasnak! Differential Revision: https://reviews.llvm.org/D40084 llvm-svn: 318387
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/LatencyPriorityQueue.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LatencyPriorityQueue.cpp b/llvm/lib/CodeGen/LatencyPriorityQueue.cpp
index 86ef898932a..8ffd51a550f 100644
--- a/llvm/lib/CodeGen/LatencyPriorityQueue.cpp
+++ b/llvm/lib/CodeGen/LatencyPriorityQueue.cpp
@@ -134,6 +134,7 @@ SUnit *LatencyPriorityQueue::pop() {
void LatencyPriorityQueue::remove(SUnit *SU) {
assert(!Queue.empty() && "Queue is empty!");
std::vector<SUnit *>::iterator I = find(Queue, SU);
+ assert(I != Queue.end() && "Queue doesn't contain the SU being removed!");
if (I != std::prev(Queue.end()))
std::swap(*I, Queue.back());
Queue.pop_back();
OpenPOWER on IntegriCloud