forked from OSchip/llvm-project
building on the new CallGraphSCC abstraction, teach CallGraphSCCPassManager
to keep the node entries in scc_iterator up to date instead of dangling as the SCC mutates. This is a really terrible problem which was causing -g to affect codegen because it would permute the memory image of the compiler process. Thanks to Dale for expertly hunting it down. llvm-svn: 101565
This commit is contained in:
parent
9becdddc49
commit
de023a3c1d
|
@ -183,6 +183,15 @@ public:
|
|||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ReplaceNode - This informs the scc_iterator that the specified Old node
|
||||
/// has been deleted, and New is to be used in its place.
|
||||
void ReplaceNode(NodeType *Old, NodeType *New) {
|
||||
assert(!nodeVisitNumbers.count(New) && "New already in scc_iterator?");
|
||||
assert(nodeVisitNumbers.count(Old) && "Old not in scc_iterator?");
|
||||
nodeVisitNumbers[New] = nodeVisitNumbers[Old];
|
||||
nodeVisitNumbers.erase(Old);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -417,6 +417,11 @@ void CallGraphSCC::ReplaceNode(CallGraphNode *Old, CallGraphNode *New) {
|
|||
Nodes[i] = New;
|
||||
break;
|
||||
}
|
||||
|
||||
// Update the active scc_iterator so that it doesn't contain dangling
|
||||
// pointers to the old CallGraphNode.
|
||||
scc_iterator<CallGraph*> *CGI = (scc_iterator<CallGraph*>*)Context;
|
||||
CGI->ReplaceNode(Old, New);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue