[llvm-commits] [llvm] r110291 - in /llvm/trunk/tools/bugpoint: BugDriver.h CrashDebugger.cpp FindBugs.cpp Miscompilation.cpp OptimizerDriver.cpp
Rafael Espindola
rafael.espindola at gmail.com
Wed Aug 4 17:29:05 PDT 2010
Author: rafael
Date: Wed Aug 4 19:29:04 2010
New Revision: 110291
URL: http://llvm.org/viewvc/llvm-project?rev=110291&view=rev
Log:
Make EmitProgressBitcode const and add a Module argument to runPasses. Use
that argument to simplify runPassesOn.
Modified:
llvm/trunk/tools/bugpoint/BugDriver.h
llvm/trunk/tools/bugpoint/CrashDebugger.cpp
llvm/trunk/tools/bugpoint/FindBugs.cpp
llvm/trunk/tools/bugpoint/Miscompilation.cpp
llvm/trunk/tools/bugpoint/OptimizerDriver.cpp
Modified: llvm/trunk/tools/bugpoint/BugDriver.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/BugDriver.h?rev=110291&r1=110290&r2=110291&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/BugDriver.h (original)
+++ llvm/trunk/tools/bugpoint/BugDriver.h Wed Aug 4 19:29:04 2010
@@ -213,7 +213,7 @@
/// "bugpoint-ID.bc".
///
void EmitProgressBitcode(const Module *M, const std::string &ID,
- bool NoFlyer = false);
+ bool NoFlyer = false) const;
/// deleteInstructionFromProgram - This method clones the current Program and
/// deletes the specified instruction from the cloned module. It then runs a
@@ -261,7 +261,8 @@
/// or failed, unless Quiet is set. ExtraArgs specifies additional arguments
/// to pass to the child bugpoint instance.
///
- bool runPasses(const std::vector<const PassInfo*> &PassesToRun,
+ bool runPasses(Module *Program,
+ const std::vector<const PassInfo*> &PassesToRun,
std::string &OutputFilename, bool DeleteOutput = false,
bool Quiet = false, unsigned NumExtraArgs = 0,
const char * const *ExtraArgs = NULL) const;
@@ -289,7 +290,7 @@
bool runPasses(const std::vector<const PassInfo*> &PassesToRun,
bool DeleteOutput = true) const {
std::string Filename;
- return runPasses(PassesToRun, Filename, DeleteOutput);
+ return runPasses(Program, PassesToRun, Filename, DeleteOutput);
}
/// runAsChild - The actual "runPasses" guts that runs in a child process.
Modified: llvm/trunk/tools/bugpoint/CrashDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/CrashDebugger.cpp?rev=110291&r1=110290&r2=110291&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/CrashDebugger.cpp (original)
+++ llvm/trunk/tools/bugpoint/CrashDebugger.cpp Wed Aug 4 19:29:04 2010
@@ -68,7 +68,7 @@
outs() << "Checking to see if these passes crash: "
<< getPassesString(Prefix) << ": ";
std::string PfxOutput;
- if (BD.runPasses(Prefix, PfxOutput))
+ if (BD.runPasses(BD.getProgram(), Prefix, PfxOutput))
return KeepPrefix;
PrefixOutput.set(PfxOutput);
Modified: llvm/trunk/tools/bugpoint/FindBugs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/FindBugs.cpp?rev=110291&r1=110290&r2=110291&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/FindBugs.cpp (original)
+++ llvm/trunk/tools/bugpoint/FindBugs.cpp Wed Aug 4 19:29:04 2010
@@ -62,7 +62,7 @@
}
std::string Filename;
- if(runPasses(PassesToRun, Filename, false)) {
+ if(runPasses(Program, PassesToRun, Filename, false)) {
outs() << "\n";
outs() << "Optimizer passes caused failure!\n\n";
debugOptimizerCrash();
Modified: llvm/trunk/tools/bugpoint/Miscompilation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/Miscompilation.cpp?rev=110291&r1=110290&r2=110291&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/Miscompilation.cpp (original)
+++ llvm/trunk/tools/bugpoint/Miscompilation.cpp Wed Aug 4 19:29:04 2010
@@ -67,7 +67,8 @@
<< "' compiles correctly: ";
std::string BitcodeResult;
- if (BD.runPasses(Suffix, BitcodeResult, false/*delete*/, true/*quiet*/)) {
+ if (BD.runPasses(BD.getProgram(), Suffix, BitcodeResult, false/*delete*/,
+ true/*quiet*/)) {
errs() << " Error running this sequence of passes"
<< " on the input program!\n";
BD.setPassesToRun(Suffix);
@@ -104,7 +105,8 @@
// kept passes, we can update our bitcode file to include the result of the
// prefix passes, then discard the prefix passes.
//
- if (BD.runPasses(Prefix, BitcodeResult, false/*delete*/, true/*quiet*/)) {
+ if (BD.runPasses(BD.getProgram(), Prefix, BitcodeResult, false/*delete*/,
+ true/*quiet*/)) {
errs() << " Error running this sequence of passes"
<< " on the input program!\n";
BD.setPassesToRun(Prefix);
@@ -144,7 +146,8 @@
<< getPassesString(Prefix) << "' passes: ";
OwningPtr<Module> OriginalInput(BD.swapProgramIn(PrefixOutput.take()));
- if (BD.runPasses(Suffix, BitcodeResult, false/*delete*/, true/*quiet*/)) {
+ if (BD.runPasses(BD.getProgram(), Suffix, BitcodeResult, false/*delete*/,
+ true/*quiet*/)) {
errs() << " Error running this sequence of passes"
<< " on the input program!\n";
BD.setPassesToRun(Suffix);
Modified: llvm/trunk/tools/bugpoint/OptimizerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/OptimizerDriver.cpp?rev=110291&r1=110290&r2=110291&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/OptimizerDriver.cpp (original)
+++ llvm/trunk/tools/bugpoint/OptimizerDriver.cpp Wed Aug 4 19:29:04 2010
@@ -66,7 +66,8 @@
/// to a file named "bugpoint-ID.bc".
///
void BugDriver::EmitProgressBitcode(const Module *M,
- const std::string &ID, bool NoFlyer) {
+ const std::string &ID,
+ bool NoFlyer) const {
// Output the input to the current pass to a bitcode file, emit a message
// telling the user how to reproduce it: opt -foo blah.bc
//
@@ -125,7 +126,8 @@
/// outs() a single line message indicating whether compilation was successful
/// or failed.
///
-bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
+bool BugDriver::runPasses(Module *Program,
+ const std::vector<const PassInfo*> &Passes,
std::string &OutputFilename, bool DeleteOutput,
bool Quiet, unsigned NumExtraArgs,
const char * const *ExtraArgs) const {
@@ -239,24 +241,19 @@
const std::vector<const PassInfo*> &Passes,
bool AutoDebugCrashes, unsigned NumExtraArgs,
const char * const *ExtraArgs) {
- Module *OldProgram = swapProgramIn(M);
std::string BitcodeResult;
- if (runPasses(Passes, BitcodeResult, false/*delete*/, true/*quiet*/,
+ if (runPasses(M, Passes, BitcodeResult, false/*delete*/, true/*quiet*/,
NumExtraArgs, ExtraArgs)) {
if (AutoDebugCrashes) {
errs() << " Error running this sequence of passes"
<< " on the input program!\n";
- delete OldProgram;
- EmitProgressBitcode(Program, "pass-error", false);
+ delete swapProgramIn(M);
+ EmitProgressBitcode(M, "pass-error", false);
exit(debugOptimizerCrash());
}
- swapProgramIn(OldProgram);
return 0;
}
- // Restore the current program.
- swapProgramIn(OldProgram);
-
Module *Ret = ParseInputFile(BitcodeResult, Context);
if (Ret == 0) {
errs() << getToolName() << ": Error reading bitcode file '"
More information about the llvm-commits
mailing list