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:
Mark Lacey
2015-04-07 05:49:39 +00:00
parent 5ce309ce76
commit 37fc0c2622

View File

@@ -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);
}