[PATCH] D72815: [BrachProbablityInfo] Add invalidate method.
Alina Sbirlea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 17:20:12 PST 2020
asbirlea created this revision.
asbirlea added reviewers: Eugene.Zelenko, chandlerc.
Herald added subscribers: sanjoy.google, hiraditya.
Herald added a project: LLVM.
Add invalidate method for BrachProbablityInfo.
Repository:
rG LLVM Github Monorepo
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 &F, 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 &F, const PreservedAnalyses &PA,
+ FunctionAnalysisManager::Invalidator &);
+
void releaseMemory();
void print(raw_ostream &OS) const;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72815.238397.patch
Type: text/x-patch
Size: 1372 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200116/9e412622/attachment.bin>
More information about the llvm-commits
mailing list