Extend the AliasAnalysis::pointsToConstantMemory interface to allow it

to optionally look for constant or local (alloca) memory.

Teach BasicAliasAnalysis::pointsToConstantMemory to look through Select
and Phi nodes, and to support looking for local memory.

Remove FunctionAttrs' PointsToLocalOrConstantMemory function, now that
AliasAnalysis knows all the tricks that it knew.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118412 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2010-11-08 16:45:26 +00:00
parent c80cbf2540
commit a25e5dbcc2
9 changed files with 85 additions and 83 deletions

View File

@@ -154,15 +154,16 @@ public:
return isNoAlias(Location(V1, V1Size), Location(V2, V2Size));
}
/// pointsToConstantMemory - If the specified memory location is known to be
/// constant, return true. This allows disambiguation of store
/// instructions from constant pointers.
///
virtual bool pointsToConstantMemory(const Location &Loc);
/// pointsToConstantMemory - If the specified memory location is
/// known to be constant, return true. If OrLocal is true and the
/// specified memory location is known to be "local" (derived from
/// an alloca), return true. Otherwise return false.
virtual bool pointsToConstantMemory(const Location &Loc,
bool OrLocal = false);
/// pointsToConstantMemory - A convenient wrapper.
bool pointsToConstantMemory(const Value *P) {
return pointsToConstantMemory(Location(P));
bool pointsToConstantMemory(const Value *P, bool OrLocal = false) {
return pointsToConstantMemory(Location(P), OrLocal);
}
//===--------------------------------------------------------------------===//