diff --git a/llvm/include/llvm/Analysis/CallGraph.h b/llvm/include/llvm/Analysis/CallGraph.h --- a/llvm/include/llvm/Analysis/CallGraph.h +++ b/llvm/include/llvm/Analysis/CallGraph.h @@ -112,6 +112,9 @@ /// Returns the module the call graph corresponds to. Module &getModule() const { return M; } + bool invalidate(Module &M, 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/llvm/lib/Analysis/CallGraph.cpp b/llvm/lib/Analysis/CallGraph.cpp --- a/llvm/lib/Analysis/CallGraph.cpp +++ b/llvm/lib/Analysis/CallGraph.cpp @@ -57,6 +57,13 @@ #endif } +bool CallGraph::invalidate(Module &M, const PreservedAnalyses &PA, + ModuleAnalysisManager::Invalidator &) { + auto PAC = PA.getChecker(); + return !(PAC.preserved() || PAC.preservedSet>() || + PAC.preservedSet()); +} + void CallGraph::addToCallGraph(Function *F) { CallGraphNode *Node = getOrInsertFunction(F);