aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/BasicAliasAnalysis.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-05 22:09:15 +0000
committerDan Gohman <gohman@apple.com>2010-08-05 22:09:15 +0000
commit5fa417c7904f7394d4e6dcb86e366c86867bcb5a (patch)
tree68a0821883973c55b5f4f210abc85726e4ec50c1 /lib/Analysis/BasicAliasAnalysis.cpp
parent3ecf355c7a6f6f559f3c85b46d041ffda5163a8c (diff)
downloadexternal_llvm-5fa417c7904f7394d4e6dcb86e366c86867bcb5a.zip
external_llvm-5fa417c7904f7394d4e6dcb86e366c86867bcb5a.tar.gz
external_llvm-5fa417c7904f7394d4e6dcb86e366c86867bcb5a.tar.bz2
Fix memdep's code for reasoning about dependences between two calls. A Ref
response from getModRefInfo is not useful here. Instead, check for identical calls only in the NoModRef case. Reapply r110270, and strengthen it to compensate for the memdep changes. When both calls are readonly, there is no dependence between them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110382 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r--lib/Analysis/BasicAliasAnalysis.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp
index 6bb84d4..11cba99 100644
--- a/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/lib/Analysis/BasicAliasAnalysis.cpp
@@ -425,8 +425,13 @@ BasicAliasAnalysis::getModRefInfo(ImmutableCallSite CS1,
ModRefBehavior CS2B = AliasAnalysis::getModRefBehavior(CS2);
if (CS2B == DoesNotAccessMemory) return NoModRef;
- // If they both only read from memory, just return ref.
+ // If they both only read from memory, there is no dependence.
if (CS1B == OnlyReadsMemory && CS2B == OnlyReadsMemory)
+ return NoModRef;
+
+ // If CS1 only reads memory, the only dependence on CS2 can be
+ // from CS1 reading memory written by CS2.
+ if (CS1B == OnlyReadsMemory)
return Ref;
// Otherwise, fall back to NoAA (mod+ref).