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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28950 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-06-27 23:48:59 +00:00
parent 4ba6bf7458
commit f299857496

View File

@ -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;
// Drop all call sites.
AS.CallSites.clear();
// 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);
// 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) {