diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h index 7a10183c4d9..c148950cd42 100644 --- a/include/llvm/Analysis/CallGraph.h +++ b/include/llvm/Analysis/CallGraph.h @@ -112,6 +112,9 @@ public: /// Returns the module the call graph corresponds to. Module &getModule() const { return M; } + bool invalidate(Module &, const PreservedAnalyses &PA, + ModuleAnalysisManager::Invalidator &); + inline iterator begin() { return FunctionMap.begin(); } inline iterator end() { return FunctionMap.end(); } inline const_iterator begin() const { return FunctionMap.begin(); } diff --git a/lib/Analysis/CallGraph.cpp b/lib/Analysis/CallGraph.cpp index 8e8a5017851..99cdf3f0db6 100644 --- a/lib/Analysis/CallGraph.cpp +++ b/lib/Analysis/CallGraph.cpp @@ -57,6 +57,15 @@ CallGraph::~CallGraph() { #endif } +bool CallGraph::invalidate(Module &, const PreservedAnalyses &PA, + ModuleAnalysisManager::Invalidator &) { + // Check whether the analysis, all analyses on functions, or the function's + // CFG have been preserved. + auto PAC = PA.getChecker(); + return !(PAC.preserved() || PAC.preservedSet>() || + PAC.preservedSet()); +} + void CallGraph::addToCallGraph(Function *F) { CallGraphNode *Node = getOrInsertFunction(F);