#include "llvm/Instructions.h"
#include "llvm/Function.h"
#include "llvm/Analysis/AliasAnalysis.h"
-#include "llvm/Analysis/Dominators.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Target/TargetData.h"
AU.setPreservesAll();
AU.addRequiredTransitive<AliasAnalysis>();
AU.addRequiredTransitive<TargetData>();
- AU.addRequiredTransitive<DominatorTree>();
}
/// getCallSiteDependency - Private helper for finding the local dependencies
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();
continue;
}
- // Don't recur upwards if the current block is unreachable.
- // Instead, mark it as having no dependency on this path,
- // which will block optzns from occuring. For this reason,
- // eliminating unreachable blocks before running a memdep
- // based optimization is recommended.
- DominatorTree& DT = getAnalysis<DominatorTree>();
- if (!DT.isReachableFromEntry(BB)) {
- resp.insert(std::make_pair(BB, None));
- continue;
- }
-
// If we didn't find anything, recurse on the precessors of this block
// Only do this for blocks with a small number of predecessors.
bool predOnStack = false;
// 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 ) &&