[llvm] 630a801 - [CallGraph] Add invalidate method.
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 17 10:48:49 PST 2020
Author: Alina Sbirlea
Date: 2020-01-17T10:47:51-08:00
New Revision: 630a8011e468fb82e546e4aae3ade5984fbfa208
URL: https://github.com/llvm/llvm-project/commit/630a8011e468fb82e546e4aae3ade5984fbfa208
DIFF: https://github.com/llvm/llvm-project/commit/630a8011e468fb82e546e4aae3ade5984fbfa208.diff
LOG: [CallGraph] Add invalidate method.
Summary: Add invalidate method in CallGraph.
Reviewers: Eugene.Zelenko, chandlerc
Subscribers: hiraditya, sanjoy.google, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72816
Added:
Modified:
llvm/include/llvm/Analysis/CallGraph.h
llvm/lib/Analysis/CallGraph.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/CallGraph.h b/llvm/include/llvm/Analysis/CallGraph.h
index 7a10183c4d91..c148950cd427 100644
--- a/llvm/include/llvm/Analysis/CallGraph.h
+++ b/llvm/include/llvm/Analysis/CallGraph.h
@@ -112,6 +112,9 @@ class CallGraph {
/// 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/llvm/lib/Analysis/CallGraph.cpp b/llvm/lib/Analysis/CallGraph.cpp
index 8e8a50178518..99cdf3f0db6c 100644
--- a/llvm/lib/Analysis/CallGraph.cpp
+++ b/llvm/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<CallGraphAnalysis>();
+ return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Module>>() ||
+ PAC.preservedSet<CFGAnalyses>());
+}
+
void CallGraph::addToCallGraph(Function *F) {
CallGraphNode *Node = getOrInsertFunction(F);
More information about the llvm-commits
mailing list