[llvm] 9c776c2 - [NFC][NewPM] Remove some AnalysisManager invalidate methods
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 15 16:57:04 PDT 2021
Author: Arthur Eubanks
Date: 2021-04-15T16:51:26-07:00
New Revision: 9c776c2fa2bdd1aa48243f9e222a76e52e055153
URL: https://github.com/llvm/llvm-project/commit/9c776c2fa2bdd1aa48243f9e222a76e52e055153
DIFF: https://github.com/llvm/llvm-project/commit/9c776c2fa2bdd1aa48243f9e222a76e52e055153.diff
LOG: [NFC][NewPM] Remove some AnalysisManager invalidate methods
These were misleading, they're more of a "clear" than an "invalidate".
We shouldn't be individually clearing analysis results. Either we clear
all analyses when some IR becomes invalid, or we properly go through
invalidation.
There was only one use of this, which can be simulated with
AM.invalidate(F, PA).
Reviewed By: mtrofin
Differential Revision: https://reviews.llvm.org/D100519
Added:
Modified:
llvm/include/llvm/IR/PassManager.h
llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h
index c669565aa33b..79d5093720ef 100644
--- a/llvm/include/llvm/IR/PassManager.h
+++ b/llvm/include/llvm/IR/PassManager.h
@@ -860,16 +860,6 @@ template <typename IRUnitT, typename... ExtraArgTs> class AnalysisManager {
return true;
}
- /// Invalidate a specific analysis pass for an IR unit.
- ///
- /// Note that the analysis result can disregard invalidation, if it determines
- /// it is in fact still valid.
- template <typename PassT> void invalidate(IRUnitT &IR) {
- assert(AnalysisPasses.count(PassT::ID()) &&
- "This analysis pass was not registered prior to being invalidated");
- invalidateImpl(PassT::ID(), IR);
- }
-
/// Invalidate cached analyses for an IR unit.
///
/// Walk through all of the analyses pertaining to this unit of IR and
@@ -904,20 +894,6 @@ template <typename IRUnitT, typename... ExtraArgTs> class AnalysisManager {
return RI == AnalysisResults.end() ? nullptr : &*RI->second->second;
}
- /// Invalidate a pass result for a IR unit.
- void invalidateImpl(AnalysisKey *ID, IRUnitT &IR) {
- typename AnalysisResultMapT::iterator RI =
- AnalysisResults.find({ID, &IR});
- if (RI == AnalysisResults.end())
- return;
-
- if (DebugLogging)
- dbgs() << "Invalidating analysis: " << this->lookUpPass(ID).name()
- << " on " << IR.getName() << "\n";
- AnalysisResultLists[&IR].erase(RI->second);
- AnalysisResults.erase(RI);
- }
-
/// Map type from analysis pass ID to pass concept pointer.
using AnalysisPassMapT =
DenseMap<AnalysisKey *, std::unique_ptr<PassConceptT>>;
diff --git a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
index 2e44ee8f20b7..0e5653eeb7d5 100644
--- a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
@@ -1785,8 +1785,11 @@ PreservedAnalyses IRCEPass::run(Function &F, FunctionAnalysisManager &AM) {
}
Changed |= CFGChanged;
- if (CFGChanged && !SkipProfitabilityChecks)
- AM.invalidate<BlockFrequencyAnalysis>(F);
+ if (CFGChanged && !SkipProfitabilityChecks) {
+ PreservedAnalyses PA = PreservedAnalyses::all();
+ PA.abandon<BlockFrequencyAnalysis>();
+ AM.invalidate(F, PA);
+ }
}
SmallPriorityWorklist<Loop *, 4> Worklist;
@@ -1800,8 +1803,11 @@ PreservedAnalyses IRCEPass::run(Function &F, FunctionAnalysisManager &AM) {
Loop *L = Worklist.pop_back_val();
if (IRCE.run(L, LPMAddNewLoop)) {
Changed = true;
- if (!SkipProfitabilityChecks)
- AM.invalidate<BlockFrequencyAnalysis>(F);
+ if (!SkipProfitabilityChecks) {
+ PreservedAnalyses PA = PreservedAnalyses::all();
+ PA.abandon<BlockFrequencyAnalysis>();
+ AM.invalidate(F, PA);
+ }
}
}
More information about the llvm-commits
mailing list