Parameterize the performFinalCleanups a bit


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7477 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp
index 1aefcef..525c746 100644
--- a/tools/bugpoint/ExtractFunction.cpp
+++ b/tools/bugpoint/ExtractFunction.cpp
@@ -79,8 +79,8 @@
 /// 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 @@
   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;