[llvm-commits] CVS: llvm/lib/Analysis/AliasSetTracker.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Jun 27 16:49:11 PDT 2006



Changes in directory llvm/lib/Analysis:

AliasSetTracker.cpp updated: 1.38 -> 1.39
---
Log message:

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


---
Diffs of the changes:  (+22 -10)

 AliasSetTracker.cpp |   32 ++++++++++++++++++++++----------
 1 files changed, 22 insertions(+), 10 deletions(-)


Index: llvm/lib/Analysis/AliasSetTracker.cpp
diff -u llvm/lib/Analysis/AliasSetTracker.cpp:1.38 llvm/lib/Analysis/AliasSetTracker.cpp:1.39
--- llvm/lib/Analysis/AliasSetTracker.cpp:1.38	Mon Jun 26 14:20:48 2006
+++ llvm/lib/Analysis/AliasSetTracker.cpp	Tue Jun 27 18:48:59 2006
@@ -359,16 +359,28 @@
 /// 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) {






More information about the llvm-commits mailing list