summaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-11-15 11:00:17 +0100
committerNikita Popov <npopov@redhat.com>2022-11-15 16:27:28 +0100
commitdb5855d0e49c1a220bb7ba1cd61e6101a4a8626f (patch)
tree7d70f87b5a33a6f22978b78c28f6761dc50d6cbc /llvm/lib
parent139e08efc55b4601ce2c2cf9afbcec714aaa017a (diff)
[AST] Restrict AliasSetTracker to immutable IR
This restricts usage of AliasSetTracker to IR that does not change. We used to use it during LICM where the underlying IR could change, but remaining uses all use AST as part of a separate analysis phase. This is split out from D137955, which makes use of the new guarantee to switch to BatchAA. Differential Revision: https://reviews.llvm.org/D138014
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/AliasSetTracker.cpp73
1 files changed, 0 insertions, 73 deletions
diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp
index 24bcb8a2ba02..6523d6a9cde9 100644
--- a/llvm/lib/Analysis/AliasSetTracker.cpp
+++ b/llvm/lib/Analysis/AliasSetTracker.cpp
@@ -509,57 +509,6 @@ void AliasSetTracker::add(const AliasSetTracker &AST) {
}
}
-// deleteValue method - This method is used to remove a pointer value from the
-// AliasSetTracker entirely. It should be used when an instruction is deleted
-// from the program to update the AST. If you don't use this, you would have
-// dangling pointers to deleted instructions.
-//
-void AliasSetTracker::deleteValue(Value *PtrVal) {
- // First, look up the PointerRec for this pointer.
- PointerMapType::iterator I = PointerMap.find_as(PtrVal);
- if (I == PointerMap.end()) return; // Noop
-
- // If we found one, remove the pointer from the alias set it is in.
- AliasSet::PointerRec *PtrValEnt = I->second;
- AliasSet *AS = PtrValEnt->getAliasSet(*this);
-
- // Unlink and delete from the list of values.
- PtrValEnt->eraseFromList();
-
- if (AS->Alias == AliasSet::SetMayAlias) {
- AS->SetSize--;
- TotalMayAliasSetSize--;
- }
-
- // Stop using the alias set.
- AS->dropRef(*this);
-
- PointerMap.erase(I);
-}
-
-// copyValue - This method should be used whenever a preexisting value in the
-// program is copied or cloned, introducing a new value. Note that it is ok for
-// clients that use this method to introduce the same value multiple times: if
-// the tracker already knows about a value, it will ignore the request.
-//
-void AliasSetTracker::copyValue(Value *From, Value *To) {
- // First, look up the PointerRec for this pointer.
- PointerMapType::iterator I = PointerMap.find_as(From);
- if (I == PointerMap.end())
- return; // Noop
- assert(I->second->hasAliasSet() && "Dead entry?");
-
- AliasSet::PointerRec &Entry = getEntryFor(To);
- if (Entry.hasAliasSet()) return; // Already in the tracker!
-
- // getEntryFor above may invalidate iterator \c I, so reinitialize it.
- I = PointerMap.find_as(From);
- // Add it to the alias set it aliases...
- AliasSet *AS = I->second->getAliasSet(*this);
- AS->addPointer(*this, Entry, I->second->getSize(), I->second->getAAInfo(),
- true, true);
-}
-
AliasSet &AliasSetTracker::mergeAllAliasSets() {
assert(!AliasAnyAS && (TotalMayAliasSetSize > SaturationThreshold) &&
"Full merge should happen once, when the saturation threshold is "
@@ -673,28 +622,6 @@ LLVM_DUMP_METHOD void AliasSetTracker::dump() const { print(dbgs()); }
#endif
//===----------------------------------------------------------------------===//
-// ASTCallbackVH Class Implementation
-//===----------------------------------------------------------------------===//
-
-void AliasSetTracker::ASTCallbackVH::deleted() {
- assert(AST && "ASTCallbackVH called with a null AliasSetTracker!");
- AST->deleteValue(getValPtr());
- // this now dangles!
-}
-
-void AliasSetTracker::ASTCallbackVH::allUsesReplacedWith(Value *V) {
- AST->copyValue(getValPtr(), V);
-}
-
-AliasSetTracker::ASTCallbackVH::ASTCallbackVH(Value *V, AliasSetTracker *ast)
- : CallbackVH(V), AST(ast) {}
-
-AliasSetTracker::ASTCallbackVH &
-AliasSetTracker::ASTCallbackVH::operator=(Value *V) {
- return *this = ASTCallbackVH(V, AST);
-}
-
-//===----------------------------------------------------------------------===//
// AliasSetPrinter Pass
//===----------------------------------------------------------------------===//