summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-05-25 21:28:56 +0000
committerChris Lattner <sabre@nondot.org>2009-05-25 21:28:56 +0000
commit02274a7171bbb7d03102fe8dbb4d70ab61e30c2d (patch)
tree5e6df2aa938a3a3d9e38b15720146db38d68a3a8 /llvm/lib/Analysis
parent47be7d135cee0027000a7036df56f5d92aa3f2d3 (diff)
downloadbcm5719-llvm-02274a7171bbb7d03102fe8dbb4d70ab61e30c2d.tar.gz
bcm5719-llvm-02274a7171bbb7d03102fe8dbb4d70ab61e30c2d.zip
make memdep use the getModRefInfo method for stores instead of the
low-level alias() method, allowing it to reason more aggressively about pointers into constant memory. PR4189 llvm-svn: 72403
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/MemoryDependenceAnalysis.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
index 74c962147ce..3b2102955f3 100644
--- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -202,9 +202,17 @@ getPointerDependencyFrom(Value *MemPtr, uint64_t MemSize, bool isLoad,
}
if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) {
+ // If alias analysis can tell that this store is guaranteed to not modify
+ // the query pointer, ignore it. Use getModRefInfo to handle cases where
+ // the query pointer points to constant memory etc.
+ if (AA->getModRefInfo(SI, MemPtr, MemSize) == AliasAnalysis::NoModRef)
+ continue;
+
+ // Ok, this store might clobber the query pointer. Check to see if it is
+ // a must alias: in this case, we want to return this as a def.
Value *Pointer = SI->getPointerOperand();
uint64_t PointerSize = TD->getTypeStoreSize(SI->getOperand(0)->getType());
-
+
// If we found a pointer, check if it could be the same as our pointer.
AliasAnalysis::AliasResult R =
AA->alias(Pointer, PointerSize, MemPtr, MemSize);
OpenPOWER on IntegriCloud