llvm.org GIT mirror llvm / ca5e4f8
reenable r101565, removing a problematic assertion. CGSCC can delete nodes in regions of the callgraph that have already been visited. If new CG nodes are allocated to the same pointer, we shouldn't abort, just handle it correctly by assigning a new number. This should restore stability by removing invalidated pointers that *will* be reused from the densemap in the iterator. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101628 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
2 changed file(s) with 2 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
6565 std::vector MinVisitNumStack;
6666
6767 // A single "visit" within the non-recursive DFS traversal.
68 void DFSVisitOne(NodeType* N) {
68 void DFSVisitOne(NodeType *N) {
6969 ++visitNum; // Global counter for the visit order
7070 nodeVisitNumbers[N] = visitNum;
7171 SCCNodeStack.push_back(N);
8282 // TOS has at least one more child so continue DFS
8383 NodeType *childN = *VisitStack.back().second++;
8484 if (!nodeVisitNumbers.count(childN)) {
85 // this node has never been seen
85 // this node has never been seen.
8686 DFSVisitOne(childN);
8787 continue;
8888 }
186186 /// ReplaceNode - This informs the scc_iterator that the specified Old node
187187 /// has been deleted, and New is to be used in its place.
188188 void ReplaceNode(NodeType *Old, NodeType *New) {
189 assert(!nodeVisitNumbers.count(New) && "New already in scc_iterator?");
190189 assert(nodeVisitNumbers.count(Old) && "Old not in scc_iterator?");
191190 nodeVisitNumbers[New] = nodeVisitNumbers[Old];
192191 nodeVisitNumbers.erase(Old);
419419
420420 // Update the active scc_iterator so that it doesn't contain dangling
421421 // pointers to the old CallGraphNode.
422 #if 0
423422 scc_iterator *CGI = (scc_iterator*)Context;
424423 CGI->ReplaceNode(Old, New);
425 #endif
426424 }
427425
428426