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).
- static cl::opt<int>
- 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<int>
+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");
for (nonLocalDepMapType::iterator I = depGraphNonLocal.begin(), E = depGraphNonLocal.end();
I != E; ++I) {
assert(I->first != D);
+ for (DenseMap<BasicBlock*, Value*>::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();
BasicBlock::iterator blockBegin = C.getInstruction()->getParent()->begin();
BasicBlock::iterator QI = C.getInstruction();
- // If the starting point was specifiy, use it
+ // If the starting point was specified, use it
if (start) {
QI = start;
blockBegin = start->getParent()->begin();
// FreeInsts erase the entire structure
pointerSize = ~0UL;
- } else if (isa<CallInst>(QI)) {
+ } else if (CallSite::get(QI).getInstruction() != 0) {
AliasAnalysis::ModRefBehavior result =
AA.getModRefBehavior(CallSite::get(QI));
if (result != AliasAnalysis::DoesNotAccessMemory) {
resp = cached;
+ // Update the reverse non-local dependency cache
+ for (DenseMap<BasicBlock*, Value*>::iterator I = resp.begin(), E = resp.end();
+ I != E; ++I)
+ reverseDepNonLocal[I->second].insert(query);
+
return;
} else
NumUncacheNonlocal++;
// If we have dep info for rem, set them to it
BasicBlock::iterator RI = depGraphEntry->second.first;
RI++;
+
+ // If RI is rem, then we use rem's immediate successor.
+ if (RI == (BasicBlock::iterator)rem) RI++;
+
newDep = RI;
} else if ( (depGraphEntry->second.first == NonLocal ||
depGraphEntry->second.first == None ) &&