mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix an issue with call graph maintainence in closure specializer.
The code was previously adding a call graph node for every apply we rewrote, rather than only adding call graph nodes when we actually create a new specialization. This causes an assert in the stdlib build, but only with other local changes I have. Swift SVN r27062
This commit is contained in:
@@ -292,7 +292,6 @@ static void rewriteApplyInst(const CallSiteDescriptor &CSDesc,
|
||||
Builder.createReleaseValue(Closure->getLoc(), Closure);
|
||||
|
||||
CallGraphEditor Editor(CG);
|
||||
Editor.addCallGraphNode(NewF);
|
||||
Editor.replaceApplyWithNew(AI, NewAI);
|
||||
|
||||
// Replace all uses of the old apply with the new apply.
|
||||
@@ -332,9 +331,14 @@ void CallSiteDescriptor::specializeClosure(CallGraph &CG) const {
|
||||
|
||||
// If not, create a specialized version of ApplyCallee calling the closure
|
||||
// directly.
|
||||
if (!NewF)
|
||||
if (!NewF) {
|
||||
NewF = ClosureSpecCloner::cloneFunction(*this, NewFName);
|
||||
|
||||
// Update the call graph with the newly created function.
|
||||
CallGraphEditor Editor(CG);
|
||||
Editor.addCallGraphNode(NewF);
|
||||
}
|
||||
|
||||
// Rewrite the call
|
||||
rewriteApplyInst(*this, NewF, CG);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user