mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
add a new CallGraphNode::replaceCallEdge method and use it from
argpromote to avoid invalidating an iterator. This fixes PR4977. All clang tests now pass with expensive checking (on my system at least). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81843 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -279,5 +279,22 @@ void CallGraphNode::removeOneAbstractEdgeTo(CallGraphNode *Callee) {
|
||||
}
|
||||
}
|
||||
|
||||
/// replaceCallEdge - This method replaces the edge in the node for the
|
||||
/// specified call site with a new one. Note that this method takes linear
|
||||
/// time, so it should be used sparingly.
|
||||
void CallGraphNode::replaceCallEdge(CallSite CS,
|
||||
CallSite NewCS, CallGraphNode *NewNode){
|
||||
for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) {
|
||||
assert(I != CalledFunctions.end() && "Cannot find callsite to remove!");
|
||||
if (I->first == CS.getInstruction()) {
|
||||
I->second->DropRef();
|
||||
I->first = NewCS.getInstruction();
|
||||
I->second = NewNode;
|
||||
NewNode->AddRef();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Enuse that users of CallGraph.h also link with this file
|
||||
DEFINING_FILE_FOR(CallGraph)
|
||||
|
Reference in New Issue
Block a user