Parameterize the performFinalCleanups a bit
authorChris Lattner <sabre@nondot.org>
Fri, 1 Aug 2003 16:13:49 +0000 (16:13 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 1 Aug 2003 16:13:49 +0000 (16:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7477 91177308-0d34-0410-b5e6-96231b3b80d8

tools/bugpoint/BugDriver.h
tools/bugpoint/ExtractFunction.cpp

index 40c170a36aff5d708ba409f39415a48994bfc483..f86782a0bc937661612415e53d43ee15799ccad3 100644 (file)
@@ -147,9 +147,10 @@ private:
 
   /// performFinalCleanups - This method clones the current Program and performs
   /// a series of cleanups intended to get rid of extra cruft on the module
-  /// before handing it to the user...
+  /// before handing it to the user... if the module parameter is specified, it
+  /// operates directly on the specified Module, modifying it in place.
   ///
-  Module *performFinalCleanups() const;
+  Module *performFinalCleanups(Module *M = 0) const;
 
   /// initializeExecutionEnvironment - This method is used to set up the
   /// environment for executing LLVM programs.
index 1aefcefad4bc253cefca274ce83470f85b3da059..525c7467f163013d9f9be5492b755ff7614c2968 100644 (file)
@@ -79,8 +79,8 @@ Module *BugDriver::deleteInstructionFromProgram(Instruction *I,
 /// a series of cleanups intended to get rid of extra cruft on the module
 /// before handing it to the user...
 ///
-Module *BugDriver::performFinalCleanups() const {
-  Module *M = CloneModule(Program);
+Module *BugDriver::performFinalCleanups(Module *InM) const {
+  Module *M = InM ? InM : CloneModule(Program);
 
   // Allow disabling these passes if they crash bugpoint.
   //
@@ -97,7 +97,7 @@ Module *BugDriver::performFinalCleanups() const {
   CleanupPasses.add(createFunctionResolvingPass());
   CleanupPasses.add(createGlobalDCEPass());
   CleanupPasses.add(createDeadTypeEliminationPass());
-  CleanupPasses.add(createDeadArgEliminationPass(true));
+  CleanupPasses.add(createDeadArgEliminationPass(InM == 0));
   CleanupPasses.add(createVerifierPass());
   CleanupPasses.run(*M);
   return M;