Do not build the call graph just to maintain it.

Before this commit, passes that were attempting to maintain the call
graph would actually build it if it wasn't already valid, just for the
sake of maintaining it.

Now we only maintain it if we already had a valid call graph built.

Swift SVN r26873
This commit is contained in:
Mark Lacey
2015-04-02 17:16:01 +00:00
parent 69a12dfcb8
commit 23b6bd84f6
12 changed files with 44 additions and 32 deletions

View File

@@ -360,7 +360,14 @@ public:
return S->getKind() == AnalysisKind::CallGraph;
}
bool haveCallGraph() { return CG; }
CallGraph *getCallGraphOrNull() { return CG; }
CallGraph &getCallGraph() {
assert(haveCallGraph() && "Expected constructed call graph!");
return *CG;
}
CallGraph &getOrBuildCallGraph() {
if (!CG)
CG = new CallGraph(M, false);
return *CG;