Fix an assertion failure in Bugpoint
authorChris Lattner <sabre@nondot.org>
Thu, 23 Oct 2003 15:42:55 +0000 (15:42 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 23 Oct 2003 15:42:55 +0000 (15:42 +0000)
llvm-svn: 9406

llvm/tools/bugpoint/ExtractFunction.cpp

index f031d34..c65b482 100644 (file)
@@ -22,6 +22,7 @@
 #include "llvm/Transforms/IPO.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Utils/Cloning.h"
+#include "llvm/Target/TargetData.h"
 #include "Support/CommandLine.h"
 
 bool DisableSimplifyCFG = false;
@@ -72,6 +73,9 @@ Module *BugDriver::deleteInstructionFromProgram(Instruction *I,
 
   // Spiff up the output a little bit.
   PassManager Passes;
+  // Make sure that the appropriate target data is always used...
+  Passes.add(new TargetData("bugpoint", Result));
+
   if (Simplification > 2 && !NoADCE)
     Passes.add(createAggressiveDCEPass());          // Remove dead code...
   //Passes.add(createInstructionCombiningPass());
@@ -104,6 +108,8 @@ Module *BugDriver::performFinalCleanups(Module *InM) const {
     I->setLinkage(GlobalValue::ExternalLinkage);
   
   PassManager CleanupPasses;
+  // Make sure that the appropriate target data is always used...
+  CleanupPasses.add(new TargetData("bugpoint", M));
   CleanupPasses.add(createFunctionResolvingPass());
   CleanupPasses.add(createGlobalDCEPass());
   CleanupPasses.add(createDeadTypeEliminationPass());