diff options
author | Owen Anderson <resistor@mac.com> | 2009-10-28 06:30:52 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-10-28 06:30:52 +0000 |
commit | a85a66423d966bf6210daf9587dba7ec1ff8d64e (patch) | |
tree | c531f5d0d77e310954c17caf19b4d23ee515b742 /lib/Analysis/MemoryDependenceAnalysis.cpp | |
parent | 89321166da67fb688e94ab9e5ad0c40de4a18cdb (diff) |
Be more careful about invariance reasoning on "store" queries. Stores still need
to depend on Ref and ModRef calls within the invariant region.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85380 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/MemoryDependenceAnalysis.cpp')
-rw-r--r-- | lib/Analysis/MemoryDependenceAnalysis.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp index edead091ed..be5f9c1ae0 100644 --- a/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -230,12 +230,11 @@ getPointerDependencyFrom(Value *MemPtr, uint64_t MemSize, bool isLoad, return MemDepResult::getDef(Inst); } - // If we're querying on a store and we're in an invariant region, we're done - // at this point. The only things that stores depend on that could exist in - // an invariant region are loads, which we've already checked. - if (invariantTag) continue; - if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) { + // There can't be stores to the value we care about inside an + // invariant region. + if (invariantTag) continue; + // 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. @@ -280,12 +279,16 @@ getPointerDependencyFrom(Value *MemPtr, uint64_t MemSize, bool isLoad, case AliasAnalysis::NoModRef: // If the call has no effect on the queried pointer, just ignore it. continue; + case AliasAnalysis::Mod: + // If we're in an invariant region, we can ignore calls that ONLY + // modify the pointer. + if (invariantTag) continue; + return MemDepResult::getClobber(Inst); case AliasAnalysis::Ref: // If the call is known to never store to the pointer, and if this is a // load query, we can safely ignore it (scan past it). if (isLoad) continue; - // FALL THROUGH. default: // Otherwise, there is a potential dependence. Return a clobber. return MemDepResult::getClobber(Inst); |