summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-06-27 23:48:59 +0000
committerChris Lattner <sabre@nondot.org>2006-06-27 23:48:59 +0000
commitf4e0653b3ae8554b8ebc43d639d81d2236a4f5c7 (patch)
treeaf872c729c0da98599daf583624d1249fd0daa7b /llvm/lib/Analysis
parent5f49a00b9f81e8180c9301220eaca9c64564eb24 (diff)
downloadbcm5719-llvm-f4e0653b3ae8554b8ebc43d639d81d2236a4f5c7.tar.gz
bcm5719-llvm-f4e0653b3ae8554b8ebc43d639d81d2236a4f5c7.zip
Don't implement AliasSetTracker::remove in terms of deleteValue. deleteValue
causes the pointer to be removed from the underlying alias analysis implementation as well. This impl of remove is also significantly faster than the old one. This fixes: Regression/Transforms/DeadStoreElimination/2006-06-27-AST-Remove.ll llvm-svn: 28950
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/AliasSetTracker.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp
index 83ba69a69d0..f805a43b4e7 100644
--- a/llvm/lib/Analysis/AliasSetTracker.cpp
+++ b/llvm/lib/Analysis/AliasSetTracker.cpp
@@ -359,16 +359,28 @@ void AliasSetTracker::add(const AliasSetTracker &AST) {
/// remove - Remove the specified (potentially non-empty) alias set from the
/// tracker.
void AliasSetTracker::remove(AliasSet &AS) {
- bool SetDead;
- do {
- AliasSet::iterator I = AS.begin();
- Value *Ptr = I.getPointer(); ++I;
-
- // deleteValue will delete the set automatically when the last pointer
- // reference is destroyed. "Predict" when this will happen.
- SetDead = I == AS.end();
- deleteValue(Ptr); // Delete all of the pointers from the set
- } while (!SetDead);
+ // Drop all call sites.
+ AS.CallSites.clear();
+
+ // Clear the alias set.
+ unsigned NumRefs = 0;
+ while (!AS.empty()) {
+ AliasSet::HashNodePair *P = AS.PtrList;
+
+ // Unlink from the list of values.
+ P->second.removeFromList();
+
+ // Remember how many references need to be dropped.
+ ++NumRefs;
+
+ // Finally, remove the entry.
+ PointerMap.erase(P->first);
+ }
+
+ // Stop using the alias set, removing it.
+ assert(AS.RefCount == NumRefs);
+ AS.RefCount = 0;
+ AS.removeFromTracker(*this);
}
bool AliasSetTracker::remove(Value *Ptr, unsigned Size) {
OpenPOWER on IntegriCloud