[PATCH] D72815: [BrachProbablityInfo] Add invalidate method.

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 10:52:11 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 rG62a50a95fc64: [BrachProbablityInfo] Add invalidate method. (authored by asbirlea).

Changed prior to commit:
  https://reviews.llvm.org/D72815?vs=238535&id=238828#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72815

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


Index: llvm/lib/Analysis/BranchProbabilityInfo.cpp
===================================================================
--- llvm/lib/Analysis/BranchProbabilityInfo.cpp
+++ llvm/lib/Analysis/BranchProbabilityInfo.cpp
@@ -856,6 +856,15 @@
   Probs.clear();
 }
 
+bool BranchProbabilityInfo::invalidate(Function &, const PreservedAnalyses &PA,
+                                       FunctionAnalysisManager::Invalidator &) {
+  // Check whether the analysis, all analyses on functions, or the function's
+  // CFG have been preserved.
+  auto PAC = PA.getChecker<BranchProbabilityAnalysis>();
+  return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Function>>() ||
+           PAC.preservedSet<CFGAnalyses>());
+}
+
 void BranchProbabilityInfo::print(raw_ostream &OS) const {
   OS << "---- Branch Probabilities ----\n";
   // We print the probabilities from the last function the analysis ran over,
Index: llvm/include/llvm/Analysis/BranchProbabilityInfo.h
===================================================================
--- llvm/include/llvm/Analysis/BranchProbabilityInfo.h
+++ llvm/include/llvm/Analysis/BranchProbabilityInfo.h
@@ -75,6 +75,9 @@
     return *this;
   }
 
+  bool invalidate(Function &, const PreservedAnalyses &PA,
+                  FunctionAnalysisManager::Invalidator &);
+
   void releaseMemory();
 
   void print(raw_ostream &OS) const;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72815.238828.patch
Type: text/x-patch
Size: 1370 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200117/6f046eae/attachment.bin>


More information about the llvm-commits mailing list