diff options
author | Chris Lattner <sabre@nondot.org> | 2009-05-25 21:28:56 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-05-25 21:28:56 +0000 |
commit | ab9cf1282baf559771183304ffc9959882e17ebb (patch) | |
tree | c7b762f1037e2fe2aa6e9013a856e17a132af08b /lib/Analysis/MemoryDependenceAnalysis.cpp | |
parent | d67a1666ec70001ee9ce4c80ea5b0ab8e4f7a77b (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72403 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/MemoryDependenceAnalysis.cpp')
-rw-r--r-- | lib/Analysis/MemoryDependenceAnalysis.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp index 74c962147c..3b2102955f 100644 --- a/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/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); |