[llvm-branch-commits] [llvm-branch] r119623 - in /llvm/branches/Apple/whitney: include/llvm/Analysis/ScalarEvolution.h lib/Analysis/ScalarEvolution.cpp
Daniel Dunbar
daniel at zuster.org
Wed Nov 17 18:36:17 PST 2010
Author: ddunbar
Date: Wed Nov 17 20:36:17 2010
New Revision: 119623
URL: http://llvm.org/viewvc/llvm-project?rev=119623&view=rev
Log:
Merge r119587:
--
Author: Dan Gohman <gohman at apple.com>
Date: Wed Nov 17 23:28:48 2010 +0000
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/branches/Apple/whitney/include/llvm/Analysis/ScalarEvolution.h
llvm/branches/Apple/whitney/lib/Analysis/ScalarEvolution.cpp
Modified: llvm/branches/Apple/whitney/include/llvm/Analysis/ScalarEvolution.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/include/llvm/Analysis/ScalarEvolution.h?rev=119623&r1=119622&r2=119623&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/include/llvm/Analysis/ScalarEvolution.h (original)
+++ llvm/branches/Apple/whitney/include/llvm/Analysis/ScalarEvolution.h Wed Nov 17 20:36:17 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/branches/Apple/whitney/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/lib/Analysis/ScalarEvolution.cpp?rev=119623&r1=119622&r2=119623&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/branches/Apple/whitney/lib/Analysis/ScalarEvolution.cpp Wed Nov 17 20:36:17 2010
@@ -324,10 +324,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);
@@ -338,10 +335,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);
@@ -2635,10 +2629,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);
}
}
@@ -3669,10 +3660,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))
@@ -3704,11 +3692,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);
@@ -3741,11 +3725,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);
@@ -6133,3 +6113,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-branch-commits
mailing list