aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/bugpoint/BugDriver.h5
-rw-r--r--tools/bugpoint/ExtractFunction.cpp6
2 files changed, 6 insertions, 5 deletions
diff --git a/tools/bugpoint/BugDriver.h b/tools/bugpoint/BugDriver.h
index 40c170a36a..f86782a0bc 100644
--- a/tools/bugpoint/BugDriver.h
+++ b/tools/bugpoint/BugDriver.h
@@ -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.
diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp
index 1aefcefad4..525c7467f1 100644
--- a/tools/bugpoint/ExtractFunction.cpp
+++ b/tools/bugpoint/ExtractFunction.cpp
@@ -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;