[llvm] a6096b7 - [SCEV][NFC] Introduce API for mass forgetMemoizedResults query
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 24 23:49:46 PDT 2021
Author: Max Kazantsev
Date: 2021-10-25T13:49:31+07:00
New Revision: a6096b7f9ed36ccd8e8670fa1e5898b3ef271f1f
URL: https://github.com/llvm/llvm-project/commit/a6096b7f9ed36ccd8e8670fa1e5898b3ef271f1f
DIFF: https://github.com/llvm/llvm-project/commit/a6096b7f9ed36ccd8e8670fa1e5898b3ef271f1f.diff
LOG: [SCEV][NFC] Introduce API for mass forgetMemoizedResults query
This patch changes signature of forgetMemoizedResults to be able to work with
multiple SCEVs. Usage will come in follow-ups. We also plan to optimize it in the
future to work faster than individual invalidation updates. Should not change
behavior in any sense.
Split-off from D111602.
Differential Revision: https://reviews.llvm.org/D112293
Reviewed By: reames
Added:
Modified:
llvm/include/llvm/Analysis/ScalarEvolution.h
llvm/lib/Analysis/ScalarEvolution.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index 1165981d0b56..6f83cb8b270e 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -1888,8 +1888,11 @@ class ScalarEvolution {
bool splitBinaryAdd(const SCEV *Expr, const SCEV *&L, const SCEV *&R,
SCEV::NoWrapFlags &Flags);
- /// Drop memoized information computed for S.
- void forgetMemoizedResults(const SCEV *S);
+ /// Drop memoized information for all \p SCEVs.
+ void forgetMemoizedResults(ArrayRef<const SCEV *> SCEVs);
+
+ /// Helper for forgetMemoizedResults.
+ void forgetMemoizedResultsImpl(const SCEV *S);
/// Return an existing SCEV for V if there is one, otherwise return nullptr.
const SCEV *getExistingSCEV(Value *V);
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index bb80729a2909..8644ddc10c8f 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -12746,8 +12746,12 @@ bool ScalarEvolution::hasOperand(const SCEV *S, const SCEV *Op) const {
return SCEVExprContains(S, [&](const SCEV *Expr) { return Expr == Op; });
}
-void
-ScalarEvolution::forgetMemoizedResults(const SCEV *S) {
+void ScalarEvolution::forgetMemoizedResults(ArrayRef<const SCEV *> SCEVs) {
+ for (auto *S : SCEVs)
+ forgetMemoizedResultsImpl(S);
+}
+
+void ScalarEvolution::forgetMemoizedResultsImpl(const SCEV *S) {
ValuesAtScopes.erase(S);
LoopDispositions.erase(S);
BlockDispositions.erase(S);
More information about the llvm-commits
mailing list