diff --git a/include/llvm/Analysis/MemoryDependenceAnalysis.h b/include/llvm/Analysis/MemoryDependenceAnalysis.h index b3c12c1d856..00dcaf508c1 100644 --- a/include/llvm/Analysis/MemoryDependenceAnalysis.h +++ b/include/llvm/Analysis/MemoryDependenceAnalysis.h @@ -80,6 +80,17 @@ namespace llvm { /// given memory operation, what preceding memory operations it depends on. /// It builds on alias analysis information, and tries to provide a lazy, /// caching interface to a common kind of alias information query. + /// + /// The dependency information returned is somewhat unusual, but is pragmatic. + /// If queried about a store or call that might modify memory, the analysis + /// will return the instruction[s] that may either load from that memory or + /// store to it. If queried with a load or call that can never modify memory, + /// the analysis will return calls and stores that might modify the pointer, + /// but generally does not return loads unless a) they are volatile, or + /// b) they load from *must-aliased* pointers. Returning a dependence on + /// must-alias'd pointers instead of all pointers interacts well with the + /// internal caching mechanism. + /// class MemoryDependenceAnalysis : public FunctionPass { /// DepType - This enum is used to indicate what flavor of dependence this /// is. If the type is Normal, there is an associated instruction pointer. @@ -153,7 +164,7 @@ namespace llvm { virtual void getAnalysisUsage(AnalysisUsage &AU) const; /// getDependency - Return the instruction on which a memory operation - /// depends. + /// depends. See the class comment for more details. MemDepResult getDependency(Instruction *QueryInst); /// getDependencyFrom - Return the instruction on which the memory operation diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp index ef4440fbe76..45ca83ab58f 100644 --- a/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -153,7 +153,6 @@ getNonLocalDependency(Instruction *QueryInst, if (DirtyBBEntry.getInt() != Dirty) continue; // Find out if this block has a local dependency for QueryInst. - // FIXME: If the dirty entry has an instruction pointer, scan from it! // FIXME: Don't convert back and forth for MemDepResult <-> DepResultTy. // If the dirty entry has a pointer, start scanning from it so we don't have @@ -234,7 +233,6 @@ getDependencyFrom(Instruction *QueryInst, BasicBlock::iterator ScanIt, // MemDep is broken w.r.t. loads: it says that two loads of the same pointer // depend on each other. :( - // FIXME: ELIMINATE THIS! if (LoadInst *L = dyn_cast(Inst)) { Value *Pointer = L->getPointerOperand(); uint64_t PointerSize = TD.getTypeStoreSize(L->getType());