X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FAnalysis%2FMemoryDependenceAnalysis.cpp;h=2012ab473c98a697650a37a94129bc67a0c1f347;hb=ebb5a971d903aa4479bb2a21472597319a9b0086;hp=161c2fed1c7112658c13715a9355be3746fea86d;hpb=241f65321efc6ad84ed875cd9494df8ca1cff309;p=oota-llvm.git diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp index 161c2fed1c7..2012ab473c9 100644 --- a/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -28,14 +28,12 @@ using namespace llvm; -namespace { - // Control the calculation of non-local dependencies by only examining the - // predecessors if the basic block has less than X amount (50 by default). - cl::opt - PredLimit("nonlocaldep-threshold", cl::Hidden, cl::init(50), - cl::desc("Control the calculation of non-local" - "dependencies (default = 50)")); -} +// Control the calculation of non-local dependencies by only examining the +// predecessors if the basic block has less than X amount (50 by default). +static cl::opt +PredLimit("nonlocaldep-threshold", cl::Hidden, cl::init(50), + cl::desc("Control the calculation of non-local" + "dependencies (default = 50)")); STATISTIC(NumCacheNonlocal, "Number of cached non-local responses"); STATISTIC(NumUncacheNonlocal, "Number of uncached non-local responses"); @@ -60,6 +58,9 @@ void MemoryDependenceAnalysis::ping(Instruction *D) { for (nonLocalDepMapType::iterator I = depGraphNonLocal.begin(), E = depGraphNonLocal.end(); I != E; ++I) { assert(I->first != D); + for (DenseMap::iterator II = I->second.begin(), + EE = I->second.end(); II != EE; ++II) + assert(II->second != D); } for (reverseDepMapType::iterator I = reverseDep.begin(), E = reverseDep.end(); @@ -131,7 +132,7 @@ Instruction* MemoryDependenceAnalysis::getCallSiteDependency(CallSite C, // FreeInsts erase the entire structure pointerSize = ~0UL; - } else if (isa(QI)) { + } else if (CallSite::get(QI).getInstruction() != 0) { AliasAnalysis::ModRefBehavior result = AA.getModRefBehavior(CallSite::get(QI)); if (result != AliasAnalysis::DoesNotAccessMemory) { @@ -281,6 +282,11 @@ void MemoryDependenceAnalysis::getNonLocalDependency(Instruction* query, resp = cached; + // Update the reverse non-local dependency cache + for (DenseMap::iterator I = resp.begin(), E = resp.end(); + I != E; ++I) + reverseDepNonLocal[I->second].insert(query); + return; } else NumUncacheNonlocal++;