[llvm-commits] [llvm] r40882 - /llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
Owen Anderson
resistor at mac.com
Mon Aug 6 16:26:03 PDT 2007
Author: resistor
Date: Mon Aug 6 18:26:03 2007
New Revision: 40882
URL: http://llvm.org/viewvc/llvm-project?rev=40882&view=rev
Log:
Improve the accuracy of memdep for determining the dependencies of loads.
This brings GVN to parity with GCSE+LoadVN.
Modified:
llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=40882&r1=40881&r2=40882&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Mon Aug 6 18:26:03 2007
@@ -275,8 +275,14 @@
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 @@
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));
More information about the llvm-commits
mailing list