forked from OSchip/llvm-project
[BrachProbablityInfo] Add invalidate method.
Summary: Add invalidate method for BrachProbablityInfo. Reviewers: Eugene.Zelenko, chandlerc Subscribers: hiraditya, sanjoy.google, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72815
This commit is contained in:
parent
eebdd85e7d
commit
62a50a95fc
|
@ -75,6 +75,9 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool invalidate(Function &, const PreservedAnalyses &PA,
|
||||
FunctionAnalysisManager::Invalidator &);
|
||||
|
||||
void releaseMemory();
|
||||
|
||||
void print(raw_ostream &OS) const;
|
||||
|
|
|
@ -856,6 +856,15 @@ void BranchProbabilityInfo::releaseMemory() {
|
|||
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,
|
||||
|
|
Loading…
Reference in New Issue