summaryrefslogtreecommitdiff
path: root/tools/bugpoint
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-11-05 21:15:19 +0000
committerChris Lattner <sabre@nondot.org>2003-11-05 21:15:19 +0000
commit417477d6c2163e428be4e8ae9754518d877219df (patch)
tree211dd7dc5bd62b26d6ed36f1c409ab6334e0b17f /tools/bugpoint
parente7a6663eb155eb8eb5de24cf22f632790485e5f9 (diff)
downloadllvm-417477d6c2163e428be4e8ae9754518d877219df.tar.gz
llvm-417477d6c2163e428be4e8ae9754518d877219df.tar.bz2
llvm-417477d6c2163e428be4e8ae9754518d877219df.tar.xz
Simplify the performFinalCleanups interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9740 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint')
-rw-r--r--tools/bugpoint/BugDriver.h8
-rw-r--r--tools/bugpoint/CodeGeneratorBug.cpp4
-rw-r--r--tools/bugpoint/CrashDebugger.cpp3
-rw-r--r--tools/bugpoint/ExtractFunction.cpp9
4 files changed, 11 insertions, 13 deletions
diff --git a/tools/bugpoint/BugDriver.h b/tools/bugpoint/BugDriver.h
index acd579914d..6c48c04fa5 100644
--- a/tools/bugpoint/BugDriver.h
+++ b/tools/bugpoint/BugDriver.h
@@ -158,11 +158,11 @@ private:
Module *deleteInstructionFromProgram(Instruction *I, unsigned Simp) const;
/// 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... if the module parameter is specified, it
- /// operates directly on the specified Module, modifying it in place.
+ /// a series of cleanups intended to get rid of extra cruft on the module. If
+ /// the MayModifySemantics argument is true, then the cleanups is allowed to
+ /// modify how the code behaves.
///
- Module *performFinalCleanups(Module *M = 0) const;
+ void performFinalCleanups(Module *M, bool MayModifySemantics = false) const;
/// initializeExecutionEnvironment - This method is used to set up the
/// environment for executing LLVM programs.
diff --git a/tools/bugpoint/CodeGeneratorBug.cpp b/tools/bugpoint/CodeGeneratorBug.cpp
index 41df79a110..29a9f6823a 100644
--- a/tools/bugpoint/CodeGeneratorBug.cpp
+++ b/tools/bugpoint/CodeGeneratorBug.cpp
@@ -224,8 +224,8 @@ bool ReduceMisCodegenFunctions::TestFuncs(const std::vector<Function*> &Funcs,
}
// Clean up the modules, removing extra cruft that we don't need anymore...
- SafeModule = BD.performFinalCleanups(SafeModule);
- TestModule = BD.performFinalCleanups(TestModule);
+ BD.performFinalCleanups(SafeModule);
+ BD.performFinalCleanups(TestModule);
if (BD.writeProgramToFile(TestModuleBC, TestModule)) {
std::cerr << "Error writing bytecode to `" << SafeModuleBC << "'\nExiting.";
diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp
index fe13e6726d..27e99b994b 100644
--- a/tools/bugpoint/CrashDebugger.cpp
+++ b/tools/bugpoint/CrashDebugger.cpp
@@ -378,7 +378,8 @@ bool BugDriver::debugCrash() {
// Try to clean up the testcase by running funcresolve and globaldce...
std::cout << "\n*** Attempting to perform final cleanups: ";
- Module *M = performFinalCleanups();
+ Module *M = CloneModule(Program);
+ performFinalCleanups(M, true);
std::swap(Program, M);
// Find out if the pass still crashes on the cleaned up program...
diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp
index c65b482b01..2d7747af77 100644
--- a/tools/bugpoint/ExtractFunction.cpp
+++ b/tools/bugpoint/ExtractFunction.cpp
@@ -93,15 +93,13 @@ 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(Module *InM) const {
- Module *M = InM ? InM : CloneModule(Program);
-
+void BugDriver::performFinalCleanups(Module *M, bool MayModifySemantics) const {
// Allow disabling these passes if they crash bugpoint.
//
// FIXME: This should eventually run these passes in a pass list to prevent
// them from being able to crash bugpoint at all!
//
- if (NoFinalCleanup) return M;
+ if (NoFinalCleanup) return;
// Make all functions external, so GlobalDCE doesn't delete them...
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
@@ -113,8 +111,7 @@ Module *BugDriver::performFinalCleanups(Module *InM) const {
CleanupPasses.add(createFunctionResolvingPass());
CleanupPasses.add(createGlobalDCEPass());
CleanupPasses.add(createDeadTypeEliminationPass());
- CleanupPasses.add(createDeadArgEliminationPass(InM == 0));
+ CleanupPasses.add(createDeadArgEliminationPass(MayModifySemantics));
CleanupPasses.add(createVerifierPass());
CleanupPasses.run(*M);
- return M;
}