diff --git a/docs/AliasAnalysis.html b/docs/AliasAnalysis.html index 692349f8c29..7baa9467697 100644 --- a/docs/AliasAnalysis.html +++ b/docs/AliasAnalysis.html @@ -464,7 +464,7 @@ analysis results updated to reflect the changes made by these transformations.

-The AliasAnalysis interface exposes three methods which are used to +The AliasAnalysis interface exposes four methods which are used to communicate program changes from the clients to the analysis implementations. Various alias analysis implementations should use these methods to ensure that their internal data structures are kept up-to-date as the program changes (for @@ -505,6 +505,28 @@ value, then deleting the old value. This method cannot be overridden by alias analysis implementations. + +

The addEscapingUse method
+ +
+

The addEscapingUse method is used when the uses of a pointer +value have changed in ways that may invalidate precomputed analysis information. +Implementations may either use this callback to provide conservative responses +for points whose uses have change since analysis time, or may recompute some +or all of their internal state to continue providing accurate responses.

+ +

In general, any new use of a pointer value is considered an escaping use, +and must be reported through this callback, except for the +uses below:

+ + +
+
Efficiency Issues diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h index c218e057f02..2375a07bfbd 100644 --- a/include/llvm/Analysis/AliasAnalysis.h +++ b/include/llvm/Analysis/AliasAnalysis.h @@ -469,6 +469,17 @@ public: /// virtual void copyValue(Value *From, Value *To); + /// addEscapingUse - This method should be used whenever an escaping use is + /// added to a pointer value. Analysis implementations may either return + /// conservative responses for that value in the future, or may recompute + /// some or all internal state to continue providing precise responses. + /// + /// Escaping uses are considered by anything _except_ the following: + /// - GEPs or bitcasts of the pointer + /// - Loads through the pointer + /// - Stores through (but not of) the pointer + virtual void addEscapingUse(Use &U); + /// replaceWithNewValue - This method is the obvious combination of the two /// above, and it provided as a helper to simplify client code. /// diff --git a/lib/Analysis/AliasAnalysis.cpp b/lib/Analysis/AliasAnalysis.cpp index 7a94c431dee..be02ddbaa53 100644 --- a/lib/Analysis/AliasAnalysis.cpp +++ b/lib/Analysis/AliasAnalysis.cpp @@ -65,6 +65,12 @@ void AliasAnalysis::copyValue(Value *From, Value *To) { AA->copyValue(From, To); } +void AliasAnalysis::addEscapingUse(Use &U) { + assert(AA && "AA didn't call InitializeAliasAnalysis in its run method!"); + AA->addEscapingUse(U); +} + + AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo(ImmutableCallSite CS, const Location &Loc) {