Skip to content

Commit a6096b7

Browse files
committed
[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
1 parent a27ae8a commit a6096b7

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

llvm/include/llvm/Analysis/ScalarEvolution.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,8 +1888,11 @@ class ScalarEvolution {
18881888
bool splitBinaryAdd(const SCEV *Expr, const SCEV *&L, const SCEV *&R,
18891889
SCEV::NoWrapFlags &Flags);
18901890

1891-
/// Drop memoized information computed for S.
1892-
void forgetMemoizedResults(const SCEV *S);
1891+
/// Drop memoized information for all \p SCEVs.
1892+
void forgetMemoizedResults(ArrayRef<const SCEV *> SCEVs);
1893+
1894+
/// Helper for forgetMemoizedResults.
1895+
void forgetMemoizedResultsImpl(const SCEV *S);
18931896

18941897
/// Return an existing SCEV for V if there is one, otherwise return nullptr.
18951898
const SCEV *getExistingSCEV(Value *V);

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12746,8 +12746,12 @@ bool ScalarEvolution::hasOperand(const SCEV *S, const SCEV *Op) const {
1274612746
return SCEVExprContains(S, [&](const SCEV *Expr) { return Expr == Op; });
1274712747
}
1274812748

12749-
void
12750-
ScalarEvolution::forgetMemoizedResults(const SCEV *S) {
12749+
void ScalarEvolution::forgetMemoizedResults(ArrayRef<const SCEV *> SCEVs) {
12750+
for (auto *S : SCEVs)
12751+
forgetMemoizedResultsImpl(S);
12752+
}
12753+
12754+
void ScalarEvolution::forgetMemoizedResultsImpl(const SCEV *S) {
1275112755
ValuesAtScopes.erase(S);
1275212756
LoopDispositions.erase(S);
1275312757
BlockDispositions.erase(S);

0 commit comments

Comments
 (0)