[PATCH] D72816: [CallGraph] Add invalidate method.

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 10:52:19 PST 2020


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG630a8011e468: [CallGraph]  Add invalidate method. (authored by asbirlea).

Changed prior to commit:
  https://reviews.llvm.org/D72816?vs=238398&id=238829#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72816/new/

https://reviews.llvm.org/D72816

Files:
  llvm/include/llvm/Analysis/CallGraph.h
  llvm/lib/Analysis/CallGraph.cpp


Index: llvm/lib/Analysis/CallGraph.cpp
===================================================================
--- llvm/lib/Analysis/CallGraph.cpp
+++ llvm/lib/Analysis/CallGraph.cpp
@@ -57,6 +57,15 @@
 #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);
 
Index: llvm/include/llvm/Analysis/CallGraph.h
===================================================================
--- llvm/include/llvm/Analysis/CallGraph.h
+++ 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 &, 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(); }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72816.238829.patch
Type: text/x-patch
Size: 1356 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200117/f4d864c4/attachment.bin>


More information about the llvm-commits mailing list