[llvm-commits] [llvm] r109718 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h include/llvm/Analysis/ScalarEvolutionExpressions.h lib/Analysis/ScalarEvolution.cpp unittests/Analysis/ unittests/Makefile
Eric Christopher
echristo at apple.com
Wed Jul 28 18:25:38 PDT 2010
Author: echristo
Date: Wed Jul 28 20:25:38 2010
New Revision: 109718
URL: http://llvm.org/viewvc/llvm-project?rev=109718&view=rev
Log:
Speculatively revert r109705 since it seems to be causing some build bot
angst.
Removed:
llvm/trunk/unittests/Analysis/
Modified:
llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
llvm/trunk/unittests/Makefile
Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=109718&r1=109717&r2=109718&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Wed Jul 28 20:25:38 2010
@@ -386,11 +386,6 @@
bool isKnownPredicateWithRanges(ICmpInst::Predicate Pred,
const SCEV *LHS, const SCEV *RHS);
- /// forgetSCEVUnknown - V is being deleted or RAUW'd; remove the
- /// SCEVUnknown for it from the uniquing map, and optionally
- /// clear its contents to point to a replacement value.
- void forgetSCEVUnknown(Value *V, Value *NewV);
-
public:
static char ID; // Pass identification, replacement for typeid
ScalarEvolution();
Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h?rev=109718&r1=109717&r2=109718&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Wed Jul 28 20:25:38 2010
@@ -524,26 +524,11 @@
friend class ScalarEvolution;
friend class ScalarEvolution::SCEVCallbackVH;
- /// V - The Value represented by this SCEVUnknown.
- /// This should be an AssertingVH, however SCEVUnknowns are allocated in a
- /// BumpPtrAllocator so their destructors are never called.
+ // This should be an AssertingVH, however SCEVUnknowns are allocated in a
+ // BumpPtrAllocator so their destructors are never called.
Value *V;
-
- /// UpdateList - When values are RAUW'd with new values, and the new
- /// values already have their own SCEVUnknowns, they can end up with
- /// muliple SCEVUnknowns. This pointer links them all together so that
- /// they can all be updated when another RAUW happens.
- SCEVUnknown *UpdateList;
-
- /// getUpdateListBack - Return the last SCEVUnknown in te UpdateList.
- SCEVUnknown *getUpdateListBack() {
- SCEVUnknown *P = this;
- while (SCEVUnknown *Q = P->UpdateList) P = Q;
- return P;
- }
-
SCEVUnknown(const FoldingSetNodeIDRef ID, Value *v) :
- SCEV(ID, scUnknown), V(v), UpdateList(0) {}
+ SCEV(ID, scUnknown), V(v) {}
public:
Value *getValue() const { return V; }
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=109718&r1=109717&r2=109718&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Jul 28 20:25:38 2010
@@ -3660,59 +3660,29 @@
}
}
-/// forgetSCEVUnknown - V is being deleted or RAUW'd; remove the
-/// SCEVUnknown for it from the uniquing map, and optionally
-/// clear its contents to point to a replacement value.
-void ScalarEvolution::forgetSCEVUnknown(Value *V, Value *NewV) {
+/// forgetValue - This method should be called by the client when it has
+/// changed a value in a way that may effect its value, or which may
+/// disconnect it from a def-use chain linking it to a loop.
+void ScalarEvolution::forgetValue(Value *V) {
+ // If there's a SCEVUnknown tying this value into the SCEV
+ // space, remove it from the folding set map. The SCEVUnknown
+ // object and any other SCEV objects which reference it
+ // (transitively) remain allocated, effectively leaked until
+ // the underlying BumpPtrAllocator is freed.
+ //
// This permits SCEV pointers to be used as keys in maps
// such as the ValuesAtScopes map.
-
- // Check for an exisitng SCEVUnknown for V in the uniquing map.
FoldingSetNodeID ID;
ID.AddInteger(scUnknown);
ID.AddPointer(V);
void *IP;
if (SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) {
- // Remove the old SCEVUnknown from the uniquing map, effectively
- // leaking it from subsequent use by ScalarEvolution. There
- // may be existing SCEVs live which still point to it though.
UniqueSCEVs.RemoveNode(S);
- // If there's a replacement value, update the old SCEVUnknowns
- // so that SCEVs which still point to it see the new value.
- if (NewV) {
- // Update the old SCEVUnknown and all SCEVUnknowns on its update list
- // to point to NewV instead of V.
- for (SCEVUnknown *U = cast<SCEVUnknown>(S); U; U = U->UpdateList) {
- assert(U->V == V && "SCEVUnknown update list is inconsistent!");
- U->V = NewV;
- }
-
- // Check for an existing SCEVUnknown for NewV in the uniquing map.
- ID.clear();
- ID.AddInteger(scUnknown);
- ID.AddPointer(NewV);
- if (SCEV *NewS = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) {
- // The uniquing map already had an entry for the new
- // value. Append the old SCEVUnknown (and its update list) to the
- // new SCEVUnknown's update list.
- cast<SCEVUnknown>(NewS)->getUpdateListBack()->UpdateList =
- cast<SCEVUnknown>(S);
- } else {
- // The uniquing map did not have an entry for the new
- // value yet. Set the old SCEVUnknown, which has now been
- // updated, to be the SCEVUnknown in the uniquing map.
- UniqueSCEVs.InsertNode(S, IP);
- }
- }
+ // This isn't necessary, but we might as well remove the
+ // value from the ValuesAtScopes map too.
+ ValuesAtScopes.erase(S);
}
-}
-
-/// forgetValue - This method should be called by the client when it has
-/// changed a value in a way that may effect its value, or which may
-/// disconnect it from a def-use chain linking it to a loop.
-void ScalarEvolution::forgetValue(Value *V) {
- forgetSCEVUnknown(V, 0);
Instruction *I = dyn_cast<Instruction>(V);
if (!I) return;
@@ -5722,10 +5692,24 @@
void ScalarEvolution::SCEVCallbackVH::allUsesReplacedWith(Value *V) {
assert(SE && "SCEVCallbackVH called with a null ScalarEvolution!");
+
Value *Old = getValPtr();
- // First, update existing SCEVUnknowns.
- SE->forgetSCEVUnknown(Old, V);
+ // If there's a SCEVUnknown tying this value into the SCEV
+ // space, replace the SCEVUnknown's value with the new value
+ // for the benefit of any SCEVs still referencing it, and
+ // and remove it from the folding set map so that new scevs
+ // don't reference it.
+ FoldingSetNodeID ID;
+ ID.AddInteger(scUnknown);
+ ID.AddPointer(Old);
+ void *IP;
+ if (SCEVUnknown *S = cast_or_null<SCEVUnknown>(
+ SE->UniqueSCEVs.FindNodeOrInsertPos(ID, IP))) {
+ S->V = V;
+ SE->UniqueSCEVs.RemoveNode(S);
+ SE->ValuesAtScopes.erase(S);
+ }
// Forget all the expressions associated with users of the old value,
// so that future queries will recompute the expressions using the new
Modified: llvm/trunk/unittests/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Makefile?rev=109718&r1=109717&r2=109718&view=diff
==============================================================================
--- llvm/trunk/unittests/Makefile (original)
+++ llvm/trunk/unittests/Makefile Wed Jul 28 20:25:38 2010
@@ -9,7 +9,7 @@
LEVEL = ..
-PARALLEL_DIRS = ADT ExecutionEngine Support Transforms VMCore Analysis
+PARALLEL_DIRS = ADT ExecutionEngine Support Transforms VMCore
include $(LEVEL)/Makefile.common
More information about the llvm-commits
mailing list