summaryrefslogtreecommitdiff
path: root/tools/bugpoint/CrashDebugger.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-04-24 17:02:17 +0000
committerChris Lattner <sabre@nondot.org>2003-04-24 17:02:17 +0000
commit640f22e66d90439857a97a83896ee68c4f7128c9 (patch)
tree47bce45dc762178d2e8f5e9d03cbbcae4be925bc /tools/bugpoint/CrashDebugger.cpp
parent7899b74fdbb58bcb50641703b6f1f212a3aebcb0 (diff)
downloadllvm-640f22e66d90439857a97a83896ee68c4f7128c9.tar.gz
llvm-640f22e66d90439857a97a83896ee68c4f7128c9.tar.bz2
llvm-640f22e66d90439857a97a83896ee68c4f7128c9.tar.xz
Implement support for bugpoint to identify which FUNCTION an optimization
is miscompiling. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5893 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/CrashDebugger.cpp')
-rw-r--r--tools/bugpoint/CrashDebugger.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp
index 315e1823ce..1138c41983 100644
--- a/tools/bugpoint/CrashDebugger.cpp
+++ b/tools/bugpoint/CrashDebugger.cpp
@@ -11,6 +11,23 @@
#include "llvm/Pass.h"
#include <fstream>
+#if 0
+class DebugCrashes : public ListReducer<const PassInfo*> {
+ BugDriver &BD;
+public:
+ DebugCrashes(BugDriver &bd) : BD(bd) {}
+
+ // doTest - Return true iff running the "removed" passes succeeds, and running
+ // the "Kept" passes fail when run on the output of the "removed" passes. If
+ // we return true, we update the current module of bugpoint.
+ //
+ virtual bool doTest(const std::vector<ElTy> &Removed,
+ const std::vector<ElTy> &Kept) {
+ return BD.runPasses(Kept);
+ }
+};
+#endif
+
/// debugCrash - This method is called when some pass crashes on input. It
/// attempts to prune down the testcase to something reasonable, and figure
/// out exactly which pass is crashing.
@@ -18,7 +35,11 @@
bool BugDriver::debugCrash() {
std::cout << "\n*** Debugging optimizer crash!\n";
- // Determine which pass causes the optimizer to crash... using binary search
+#if 0
+ // Reduce the list of passes which causes the optimizer to crash...
+ DebugCrashes(*this).reduceList(PassesToRun);
+#endif
+
unsigned LastToPass = 0, LastToCrash = PassesToRun.size();
while (LastToPass != LastToCrash) {
unsigned Mid = (LastToCrash+LastToPass+1) / 2;
@@ -65,6 +86,9 @@ bool BugDriver::debugCrash() {
removeFile(Filename);
}
+ PassesToRun.clear();
+ PassesToRun.push_back(CrashingPass);
+
return debugPassCrash(CrashingPass);
}
@@ -83,7 +107,7 @@ static unsigned CountFunctions(Module *M) {
/// crashes, but it smaller.
///
bool BugDriver::debugPassCrash(const PassInfo *Pass) {
- EmitProgressBytecode(Pass, "passinput");
+ EmitProgressBytecode("passinput");
bool Reduced = false, AnyReduction = false;
if (CountFunctions(Program) > 1) {
@@ -124,7 +148,7 @@ bool BugDriver::debugPassCrash(const PassInfo *Pass) {
}
if (Reduced) {
- EmitProgressBytecode(Pass, "reduced-function");
+ EmitProgressBytecode("reduced-function");
Reduced = false;
}
@@ -196,7 +220,7 @@ bool BugDriver::debugPassCrash(const PassInfo *Pass) {
}
if (Reduced) {
- EmitProgressBytecode(Pass, "reduced-simplified");
+ EmitProgressBytecode("reduced-simplified");
Reduced = false;
}