[llvm-commits] [llvm] r119587 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h lib/Analysis/ScalarEvolution.cpp
Dan Gohman
gohman at apple.com
Wed Nov 17 15:28:49 PST 2010
Author: djg
Date: Wed Nov 17 17:28:48 2010
New Revision: 119587
URL: http://llvm.org/viewvc/llvm-project?rev=119587&view=rev
Log:
Factor out the code for purging a SCEV from all the various memoization maps.
Some of these maps may merge in the future, but for now it's convenient to have
a utility function for them.
Modified:
llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=119587&r1=119586&r2=119587&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Wed Nov 17 17:28:48 2010
@@ -413,6 +413,9 @@
bool isKnownPredicateWithRanges(ICmpInst::Predicate Pred,
const SCEV *LHS, const SCEV *RHS);
+ /// forgetMemoizedResults - Drop memoized information computed for S.
+ void forgetMemoizedResults(const SCEV *S);
+
public:
static char ID; // Pass identification, replacement for typeid
ScalarEvolution();
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=119587&r1=119586&r2=119587&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Nov 17 17:28:48 2010
@@ -325,10 +325,7 @@
void SCEVUnknown::deleted() {
// Clear this SCEVUnknown from various maps.
- SE->ValuesAtScopes.erase(this);
- SE->LoopDispositions.erase(this);
- SE->UnsignedRanges.erase(this);
- SE->SignedRanges.erase(this);
+ SE->forgetMemoizedResults(this);
// Remove this SCEVUnknown from the uniquing map.
SE->UniqueSCEVs.RemoveNode(this);
@@ -339,10 +336,7 @@
void SCEVUnknown::allUsesReplacedWith(Value *New) {
// Clear this SCEVUnknown from various maps.
- SE->ValuesAtScopes.erase(this);
- SE->LoopDispositions.erase(this);
- SE->UnsignedRanges.erase(this);
- SE->SignedRanges.erase(this);
+ SE->forgetMemoizedResults(this);
// Remove this SCEVUnknown from the uniquing map.
SE->UniqueSCEVs.RemoveNode(this);
@@ -2636,10 +2630,7 @@
if (!isa<PHINode>(I) ||
!isa<SCEVUnknown>(Old) ||
(I != PN && Old == SymName)) {
- ValuesAtScopes.erase(Old);
- LoopDispositions.erase(Old);
- UnsignedRanges.erase(Old);
- SignedRanges.erase(Old);
+ forgetMemoizedResults(Old);
ValueExprMap.erase(It);
}
}
@@ -3677,10 +3668,7 @@
// case, createNodeForPHI will perform the necessary updates on its
// own when it gets to that point.
if (!isa<PHINode>(I) || !isa<SCEVUnknown>(Old)) {
- ValuesAtScopes.erase(Old);
- LoopDispositions.erase(Old);
- UnsignedRanges.erase(Old);
- SignedRanges.erase(Old);
+ forgetMemoizedResults(Old);
ValueExprMap.erase(It);
}
if (PHINode *PN = dyn_cast<PHINode>(I))
@@ -3712,11 +3700,7 @@
ValueExprMapType::iterator It = ValueExprMap.find(static_cast<Value *>(I));
if (It != ValueExprMap.end()) {
- const SCEV *Old = It->second;
- ValuesAtScopes.erase(Old);
- LoopDispositions.erase(Old);
- UnsignedRanges.erase(Old);
- SignedRanges.erase(Old);
+ forgetMemoizedResults(It->second);
ValueExprMap.erase(It);
if (PHINode *PN = dyn_cast<PHINode>(I))
ConstantEvolutionLoopExitValue.erase(PN);
@@ -3749,11 +3733,7 @@
ValueExprMapType::iterator It = ValueExprMap.find(static_cast<Value *>(I));
if (It != ValueExprMap.end()) {
- const SCEV *Old = It->second;
- ValuesAtScopes.erase(Old);
- LoopDispositions.erase(Old);
- UnsignedRanges.erase(Old);
- SignedRanges.erase(Old);
+ forgetMemoizedResults(It->second);
ValueExprMap.erase(It);
if (PHINode *PN = dyn_cast<PHINode>(I))
ConstantEvolutionLoopExitValue.erase(PN);
@@ -6141,3 +6121,10 @@
llvm_unreachable("Unknown SCEV kind!");
return false;
}
+
+void ScalarEvolution::forgetMemoizedResults(const SCEV *S) {
+ ValuesAtScopes.erase(S);
+ LoopDispositions.erase(S);
+ UnsignedRanges.erase(S);
+ SignedRanges.erase(S);
+}
More information about the llvm-commits
mailing list