aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bugpoint/CrashDebugger.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-02-28 16:13:20 +0000
committerChris Lattner <sabre@nondot.org>2003-02-28 16:13:20 +0000
commitba386d943f4a83095d9c625cb0d46c1afe45ed1f (patch)
treed7ece90f3a70608d9d1eeafd066cbe9eddb163e7 /tools/bugpoint/CrashDebugger.cpp
parent74cd04ea0154defa837a6d4c12bad29aae44e5b6 (diff)
downloadexternal_llvm-ba386d943f4a83095d9c625cb0d46c1afe45ed1f.zip
external_llvm-ba386d943f4a83095d9c625cb0d46c1afe45ed1f.tar.gz
external_llvm-ba386d943f4a83095d9c625cb0d46c1afe45ed1f.tar.bz2
* Reduce the number of useless bytecode files produced by bugpoint.
- This also speeds it up as the bytecode writer isn't terribly fast. * Add a new cleanup pass after everything else to run -funcresolve -globaldce git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5668 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/CrashDebugger.cpp')
-rw-r--r--tools/bugpoint/CrashDebugger.cpp34
1 files changed, 31 insertions, 3 deletions
diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp
index daf3915..315e182 100644
--- a/tools/bugpoint/CrashDebugger.cpp
+++ b/tools/bugpoint/CrashDebugger.cpp
@@ -84,6 +84,7 @@ static unsigned CountFunctions(Module *M) {
///
bool BugDriver::debugPassCrash(const PassInfo *Pass) {
EmitProgressBytecode(Pass, "passinput");
+ bool Reduced = false, AnyReduction = false;
if (CountFunctions(Program) > 1) {
// Attempt to reduce the input program down to a single function that still
@@ -106,7 +107,7 @@ bool BugDriver::debugPassCrash(const PassInfo *Pass) {
// reduce the testcase...
delete M;
- EmitProgressBytecode(Pass, "reduced-"+I->getName());
+ Reduced = AnyReduction = true;
break;
}
@@ -122,6 +123,11 @@ bool BugDriver::debugPassCrash(const PassInfo *Pass) {
}
}
+ if (Reduced) {
+ EmitProgressBytecode(Pass, "reduced-function");
+ Reduced = false;
+ }
+
// FIXME: This should attempt to delete entire basic blocks at a time to speed
// up convergence...
@@ -159,8 +165,8 @@ bool BugDriver::debugPassCrash(const PassInfo *Pass) {
if (runPass(Pass)) {
// Yup, it does, we delete the old module, and continue trying to
// reduce the testcase...
- EmitProgressBytecode(Pass, "reduced-" + I->getName());
delete M;
+ Reduced = AnyReduction = true;
goto TryAgain; // I wish I had a multi-level break here!
}
@@ -171,6 +177,28 @@ bool BugDriver::debugPassCrash(const PassInfo *Pass) {
}
}
} while (Simplification);
-
+
+ // Try to clean up the testcase by running funcresolve and globaldce...
+ if (AnyReduction) {
+ std::cout << "\n*** Attempting to perform final cleanups: ";
+ Module *M = performFinalCleanups();
+ std::swap(Program, M);
+
+ // Find out if the pass still crashes on the cleaned up program...
+ if (runPass(Pass)) {
+ // Yup, it does, keep the reduced version...
+ delete M;
+ Reduced = AnyReduction = true;
+ } else {
+ delete Program; // Otherwise, restore the original module...
+ Program = M;
+ }
+ }
+
+ if (Reduced) {
+ EmitProgressBytecode(Pass, "reduced-simplified");
+ Reduced = false;
+ }
+
return false;
}