MemoryDependenceAnalysis in ModulePass


I'm having some trouble using the MemoryDependenceAnalysis pass within a ModulePass. If I use addRequired and getAnalysis, it works properly within a FunctionPass, but opt aborts when I try to do the same in a ModulePass, with the following error:

opt: /x/jeffhao/llvm/llvm/include/llvm/Target/TargetData.h:114: llvm::TargetData::TargetData(): Assertion '0 && "ERROR: Bad TargetData ctor used. " "Tool did not specify a TargetData to use?"' failed.

Has anyone else seen this error and know a way around it?