Make sure to create a target data that matches the Module's target properties.
llvm-svn: 5904
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index d03a650..0127c53 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/tools/opt/opt.cpp
@@ -113,6 +113,9 @@
//
PassManager Passes;
+ // Add an appropriate TargetData instance for this module...
+ Passes.add(new TargetData("opt", M.get()));
+
// Create a new optimization pass for each one specified on the command line
for (unsigned i = 0; i < OptimizationList.size(); ++i) {
const PassInfo *Opt = OptimizationList[i];