aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-08-06 23:26:03 +0000
committerOwen Anderson <resistor@mac.com>2007-08-06 23:26:03 +0000
commit8f3531579812089b4094fcd53ca8dbe5bec53ca0 (patch)
tree112849521dd9ccd6cd48f02a5ea39babd6592170 /lib/Analysis
parent9989a65693c357809e8e131b0a4ff1285b5e968a (diff)
downloadexternal_llvm-8f3531579812089b4094fcd53ca8dbe5bec53ca0.zip
external_llvm-8f3531579812089b4094fcd53ca8dbe5bec53ca0.tar.gz
external_llvm-8f3531579812089b4094fcd53ca8dbe5bec53ca0.tar.bz2
Improve the accuracy of memdep for determining the dependencies of loads.
This brings GVN to parity with GCSE+LoadVN. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40882 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/MemoryDependenceAnalysis.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp
index 47e47e5..53d2295 100644
--- a/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -275,8 +275,14 @@ Instruction* MemoryDependenceAnalysis::getDependency(Instruction* query,
pointerSize = ~0UL;
} else if (CallSite::get(QI).getInstruction() != 0) {
// Call insts need special handling. Check is they can modify our pointer
- if (AA.getModRefInfo(CallSite::get(QI), dependee, dependeeSize) !=
- AliasAnalysis::NoModRef) {
+ AliasAnalysis::ModRefResult MR = AA.getModRefInfo(CallSite::get(QI),
+ dependee, dependeeSize);
+
+ if (MR != AliasAnalysis::NoModRef) {
+ // Loads don't depend on read-only calls
+ if (isa<LoadInst>(query) && MR == AliasAnalysis::Ref)
+ continue;
+
if (!start || block) {
depGraphLocal.insert(std::make_pair(query, std::make_pair(QI, true)));
reverseDep.insert(std::make_pair(QI, query));
@@ -294,6 +300,11 @@ Instruction* MemoryDependenceAnalysis::getDependency(Instruction* query,
dependee, dependeeSize);
if (R != AliasAnalysis::NoAlias) {
+ // May-alias loads don't depend on each other
+ if (isa<LoadInst>(query) && isa<LoadInst>(QI) &&
+ R == AliasAnalysis::MayAlias)
+ continue;
+
if (!start || block) {
depGraphLocal.insert(std::make_pair(query, std::make_pair(QI, true)));
reverseDep.insert(std::make_pair(QI, query));