Remove the AliasAnalysis::getMustAliases method, which is dead.
authorChris Lattner <sabre@nondot.org>
Sun, 22 Nov 2009 16:01:44 +0000 (16:01 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 22 Nov 2009 16:01:44 +0000 (16:01 +0000)
The hasNoModRefInfoForCalls isn't worth it as a filter because
basicaa provides m/r info and everything chains to it, so remove
it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89599 91177308-0d34-0410-b5e6-96231b3b80d8

docs/AliasAnalysis.html
include/llvm/Analysis/AliasAnalysis.h
include/llvm/Analysis/LibCallAliasAnalysis.h
lib/Analysis/AliasAnalysis.cpp
lib/Analysis/AliasDebugger.cpp
lib/Analysis/AliasSetTracker.cpp
lib/Analysis/BasicAliasAnalysis.cpp
lib/Analysis/IPA/Andersens.cpp
lib/Analysis/IPA/GlobalsModRef.cpp

index a89903d2af81fd5c9d2f0530d15f03d155519f1d..ebf638689824b25d14329364439194cbf497e15f 100644 (file)
@@ -225,12 +225,7 @@ method for testing dependencies between function calls.  This method takes two
 call sites (CS1 &amp; CS2), returns NoModRef if the two calls refer to disjoint
 memory locations, Ref if CS1 reads memory written by CS2, Mod if CS1 writes to
 memory read or written by CS2, or ModRef if CS1 might read or write memory
-accessed by CS2.  Note that this relation is not commutative.  Clients that use
-this method should be predicated on the <tt>hasNoModRefInfoForCalls()</tt>
-method, which indicates whether or not an analysis can provide mod/ref
-information for function call pairs (most can not).  If this predicate is false,
-the client shouldn't waste analysis time querying the <tt>getModRefInfo</tt>
-method many times.</p>
+accessed by CS2.  Note that this relation is not commutative.</p>
 
 </div>
 
@@ -249,21 +244,6 @@ analysis implementations and can be put to good use by various clients.
 
 </div>
 
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  The <tt>getMustAliases</tt> method
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>getMustAliases</tt> method returns all values that are known to
-always must alias a pointer.  This information can be provided in some cases for
-important objects like the null pointer and global values.  Knowing that a
-pointer always points to a particular function allows indirect calls to be
-turned into direct calls, for example.</p>
-
-</div>
-
 <!-- _______________________________________________________________________ -->
 <div class="doc_subsubsection">
   The <tt>pointsToConstantMemory</tt> method
index be7d5ee37b80f1b1b1ba3862a013e38aecbf56f7..0b3199d234d25c7a788559f18df0455ceae00903 100644 (file)
@@ -94,14 +94,6 @@ public:
   virtual AliasResult alias(const Value *V1, unsigned V1Size,
                             const Value *V2, unsigned V2Size);
 
-  /// getMustAliases - If there are any pointers known that must alias this
-  /// pointer, return them now.  This allows alias-set based alias analyses to
-  /// perform a form a value numbering (which is exposed by load-vn).  If an
-  /// alias analysis supports this, it should ADD any must aliased pointers to
-  /// the specified vector.
-  ///
-  virtual void getMustAliases(Value *P, std::vector<Value*> &RetVals);
-
   /// pointsToConstantMemory - If the specified pointer is known to point into
   /// constant global memory, return true.  This allows disambiguation of store
   /// instructions from constant pointers.
@@ -262,14 +254,6 @@ public:
   ///
   virtual ModRefResult getModRefInfo(CallSite CS1, CallSite CS2);
 
-  /// hasNoModRefInfoForCalls - Return true if the analysis has no mod/ref
-  /// information for pairs of function calls (other than "pure" and "const"
-  /// functions).  This can be used by clients to avoid many pointless queries.
-  /// Remember that if you override this and chain to another analysis, you must
-  /// make sure that it doesn't have mod/ref info either.
-  ///
-  virtual bool hasNoModRefInfoForCalls() const;
-
 public:
   /// Convenience functions...
   ModRefResult getModRefInfo(LoadInst *L, Value *P, unsigned Size);
index 7944af3b8a5a0765ceb59221fd8dc39db470c22d..01f108d290426b57af1b2147a4dbf48f9a18a928 100644 (file)
@@ -49,9 +49,6 @@ namespace llvm {
       return false;
     }
     
-    /// hasNoModRefInfoForCalls - We can provide mod/ref information against
-    /// non-escaping allocations.
-    virtual bool hasNoModRefInfoForCalls() const { return false; }
   private:
     ModRefResult AnalyzeLibCallDetails(const LibCallFunctionInfo *FI,
                                        CallSite CS, Value *P, unsigned Size);
index 0234965a00650e03ad9a2319c7ff8d46381c0abc..92fa1df5c954c0446c6b9aeb519e30e440543fe9 100644 (file)
@@ -49,21 +49,11 @@ AliasAnalysis::alias(const Value *V1, unsigned V1Size,
   return AA->alias(V1, V1Size, V2, V2Size);
 }
 
-void AliasAnalysis::getMustAliases(Value *P, std::vector<Value*> &RetVals) {
-  assert(AA && "AA didn't call InitializeAliasAnalysis in its run method!");
-  return AA->getMustAliases(P, RetVals);
-}
-
 bool AliasAnalysis::pointsToConstantMemory(const Value *P) {
   assert(AA && "AA didn't call InitializeAliasAnalysis in its run method!");
   return AA->pointsToConstantMemory(P);
 }
 
-bool AliasAnalysis::hasNoModRefInfoForCalls() const {
-  assert(AA && "AA didn't call InitializeAliasAnalysis in its run method!");
-  return AA->hasNoModRefInfoForCalls();
-}
-
 void AliasAnalysis::deleteValue(Value *V) {
   assert(AA && "AA didn't call InitializeAliasAnalysis in its run method!");
   AA->deleteValue(V);
index cf4727f1ebee206597fe9fd92f36b5438eb3820f..6868e3f2cef26d76e85733eab47715aa9a254720 100644 (file)
@@ -90,11 +90,6 @@ namespace {
       return AliasAnalysis::getModRefInfo(CS1,CS2);
     }
     
-    void getMustAliases(Value *P, std::vector<Value*> &RetVals) {
-      assert(Vals.find(P) != Vals.end() && "Never seen value in AA before");
-      return AliasAnalysis::getMustAliases(P, RetVals);
-    }
-
     bool pointsToConstantMemory(const Value *P) {
       assert(Vals.find(P) != Vals.end() && "Never seen value in AA before");
       return AliasAnalysis::pointsToConstantMemory(P);
index c037c8d63afb32850ba746887458ebbf6c2d8f79..66346003739209cc82a623f140a8789d5aef2bc0 100644 (file)
@@ -153,9 +153,6 @@ bool AliasSet::aliasesPointer(const Value *Ptr, unsigned Size,
 
   // Check the call sites list and invoke list...
   if (!CallSites.empty()) {
-    if (AA.hasNoModRefInfoForCalls())
-      return true;
-
     for (unsigned i = 0, e = CallSites.size(); i != e; ++i)
       if (AA.getModRefInfo(CallSites[i], const_cast<Value*>(Ptr), Size)
                    != AliasAnalysis::NoModRef)
@@ -169,9 +166,6 @@ bool AliasSet::aliasesCallSite(CallSite CS, AliasAnalysis &AA) const {
   if (AA.doesNotAccessMemory(CS))
     return false;
 
-  if (AA.hasNoModRefInfoForCalls())
-    return true;
-
   for (unsigned i = 0, e = CallSites.size(); i != e; ++i)
     if (AA.getModRefInfo(CallSites[i], CS) != AliasAnalysis::NoModRef ||
         AA.getModRefInfo(CS, CallSites[i]) != AliasAnalysis::NoModRef)
index 66bb4397c3aff3ac64edb8456cc55b4276242334..5dbdfe1747d0e0ced9f04262ff5b736b05dc4f3a 100644 (file)
@@ -164,7 +164,6 @@ namespace {
       llvm_unreachable("This method may not be called on this function!");
     }
 
-    virtual void getMustAliases(Value *P, std::vector<Value*> &RetVals) { }
     virtual bool pointsToConstantMemory(const Value *P) { return false; }
     virtual ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size) {
       return ModRef;
@@ -172,7 +171,6 @@ namespace {
     virtual ModRefResult getModRefInfo(CallSite CS1, CallSite CS2) {
       return ModRef;
     }
-    virtual bool hasNoModRefInfoForCalls() const { return true; }
 
     virtual void deleteValue(Value *V) {}
     virtual void copyValue(Value *From, Value *To) {}
@@ -211,10 +209,6 @@ namespace {
     ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size);
     ModRefResult getModRefInfo(CallSite CS1, CallSite CS2);
 
-    /// hasNoModRefInfoForCalls - We can provide mod/ref information against
-    /// non-escaping allocations.
-    virtual bool hasNoModRefInfoForCalls() const { return false; }
-
     /// pointsToConstantMemory - Chase pointers until we find a (constant
     /// global) or not.
     bool pointsToConstantMemory(const Value *P);
index 40a8cd5b23e4c609201c305ca37208fa1d45bd03..e12db817440c7045a15e14528f045060106ea547 100644 (file)
@@ -484,7 +484,6 @@ namespace {
                       const Value *V2, unsigned V2Size);
     virtual ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size);
     virtual ModRefResult getModRefInfo(CallSite CS1, CallSite CS2);
-    void getMustAliases(Value *P, std::vector<Value*> &RetVals);
     bool pointsToConstantMemory(const Value *P);
 
     virtual void deleteValue(Value *V) {
@@ -680,32 +679,6 @@ Andersens::getModRefInfo(CallSite CS1, CallSite CS2) {
   return AliasAnalysis::getModRefInfo(CS1,CS2);
 }
 
-/// getMustAlias - We can provide must alias information if we know that a
-/// pointer can only point to a specific function or the null pointer.
-/// Unfortunately we cannot determine must-alias information for global
-/// variables or any other memory memory objects because we do not track whether
-/// a pointer points to the beginning of an object or a field of it.
-void Andersens::getMustAliases(Value *P, std::vector<Value*> &RetVals) {
-  Node *N = &GraphNodes[FindNode(getNode(P))];
-  if (N->PointsTo->count() == 1) {
-    Node *Pointee = &GraphNodes[N->PointsTo->find_first()];
-    // If a function is the only object in the points-to set, then it must be
-    // the destination.  Note that we can't handle global variables here,
-    // because we don't know if the pointer is actually pointing to a field of
-    // the global or to the beginning of it.
-    if (Value *V = Pointee->getValue()) {
-      if (Function *F = dyn_cast<Function>(V))
-        RetVals.push_back(F);
-    } else {
-      // If the object in the points-to set is the null object, then the null
-      // pointer is a must alias.
-      if (Pointee == &GraphNodes[NullObject])
-        RetVals.push_back(Constant::getNullValue(P->getType()));
-    }
-  }
-  AliasAnalysis::getMustAliases(P, RetVals);
-}
-
 /// pointsToConstantMemory - If we can determine that this pointer only points
 /// to constant memory, return true.  In practice, this means that if the
 /// pointer can only point to constant globals, functions, or the null pointer,
index ddd6ff9bd8253e8a8f35a9b340d7a8cadf18340d..a979a99a4de8dd30fb01141abcc30a592df481e9 100644 (file)
@@ -111,7 +111,6 @@ namespace {
     ModRefResult getModRefInfo(CallSite CS1, CallSite CS2) {
       return AliasAnalysis::getModRefInfo(CS1,CS2);
     }
-    bool hasNoModRefInfoForCalls() const { return false; }
 
     /// getModRefBehavior - Return the behavior of the specified function if
     /// called from the specified call site.  The call site may be null in which