mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
Add some asserts to check SelectionDAG problems earlier.
llvm-svn: 93960
This commit is contained in:
parent
39f85e6a96
commit
1908ff46da
@ -5179,6 +5179,7 @@ unsigned SelectionDAG::AssignTopologicalOrder() {
|
||||
allnodes_iterator Q = N;
|
||||
if (Q != SortedPos)
|
||||
SortedPos = AllNodes.insert(SortedPos, AllNodes.remove(Q));
|
||||
assert(SortedPos != AllNodes.end() && "Overran node list");
|
||||
++SortedPos;
|
||||
} else {
|
||||
// Temporarily use the Node Id as scratch space for the degree count.
|
||||
@ -5190,22 +5191,33 @@ unsigned SelectionDAG::AssignTopologicalOrder() {
|
||||
// such that by the time the end is reached all nodes will be sorted.
|
||||
for (allnodes_iterator I = allnodes_begin(),E = allnodes_end(); I != E; ++I) {
|
||||
SDNode *N = I;
|
||||
// N is in sorted position, so all its uses have one less operand
|
||||
// that needs to be sorted.
|
||||
for (SDNode::use_iterator UI = N->use_begin(), UE = N->use_end();
|
||||
UI != UE; ++UI) {
|
||||
SDNode *P = *UI;
|
||||
unsigned Degree = P->getNodeId();
|
||||
assert(Degree != 0 && "Invalid node degree");
|
||||
--Degree;
|
||||
if (Degree == 0) {
|
||||
// All of P's operands are sorted, so P may sorted now.
|
||||
P->setNodeId(DAGSize++);
|
||||
if (P != SortedPos)
|
||||
SortedPos = AllNodes.insert(SortedPos, AllNodes.remove(P));
|
||||
assert(SortedPos != AllNodes.end() && "Overran node list");
|
||||
++SortedPos;
|
||||
} else {
|
||||
// Update P's outstanding operand count.
|
||||
P->setNodeId(Degree);
|
||||
}
|
||||
}
|
||||
if (I == SortedPos) {
|
||||
allnodes_iterator J = I;
|
||||
SDNode *S = ++J;
|
||||
dbgs() << "Offending node:\n";
|
||||
S->dumprFull();
|
||||
assert(I != SortedPos && "Overran sorted position");
|
||||
}
|
||||
}
|
||||
|
||||
assert(SortedPos == AllNodes.end() &&
|
||||
|
Loading…
Reference in New Issue
Block a user