diff options
-rw-r--r-- | tools/bugpoint/BugDriver.cpp | 2 | ||||
-rw-r--r-- | tools/bugpoint/BugDriver.h | 15 | ||||
-rw-r--r-- | tools/bugpoint/CrashDebugger.cpp | 2 |
3 files changed, 8 insertions, 11 deletions
diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp index d5b0656..cf7b183 100644 --- a/tools/bugpoint/BugDriver.cpp +++ b/tools/bugpoint/BugDriver.cpp @@ -172,7 +172,7 @@ bool BugDriver::run(std::string &ErrMsg) { // miscompilation. if (!PassesToRun.empty()) { outs() << "Running selected passes on program to test for crash: "; - if (runPasses(PassesToRun)) + if (runPasses(Program, PassesToRun)) return debugOptimizerCrash(); } diff --git a/tools/bugpoint/BugDriver.h b/tools/bugpoint/BugDriver.h index 819379d..9611355 100644 --- a/tools/bugpoint/BugDriver.h +++ b/tools/bugpoint/BugDriver.h @@ -69,7 +69,7 @@ public: const char *getToolName() const { return ToolName; } - LLVMContext& getContext() { return Context; } + LLVMContext& getContext() const { return Context; } // Set up methods... these methods are used to copy information about the // command line arguments into instance variables of BugDriver. @@ -132,12 +132,8 @@ public: /// runPasses - Run all of the passes in the "PassesToRun" list, discard the /// output, and return true if any of the passes crashed. - bool runPasses(Module *M = 0) { - if (M == 0) M = Program; - std::swap(M, Program); - bool Result = runPasses(PassesToRun); - std::swap(M, Program); - return Result; + bool runPasses(Module *M) const { + return runPasses(M, PassesToRun); } Module *getProgram() const { return Program; } @@ -287,10 +283,11 @@ private: /// false indicating whether or not the optimizer crashed on the specified /// input (true = crashed). /// - bool runPasses(const std::vector<const PassInfo*> &PassesToRun, + bool runPasses(Module *M, + const std::vector<const PassInfo*> &PassesToRun, bool DeleteOutput = true) const { std::string Filename; - return runPasses(Program, PassesToRun, Filename, DeleteOutput); + return runPasses(M, PassesToRun, Filename, DeleteOutput); } /// runAsChild - The actual "runPasses" guts that runs in a child process. diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp index 735adc5..c423203 100644 --- a/tools/bugpoint/CrashDebugger.cpp +++ b/tools/bugpoint/CrashDebugger.cpp @@ -86,7 +86,7 @@ ReducePassList::doTest(std::vector<const PassInfo*> &Prefix, outs() << "Checking to see if these passes crash: " << getPassesString(Suffix) << ": "; - if (BD.runPasses(Suffix)) { + if (BD.runPasses(BD.getProgram(), Suffix)) { delete OrigProgram; // The suffix crashes alone... return KeepSuffix; } |