Generalize bugpoint's concept of a "safe" backend, and add options

to allow the "safe" backend to be run with a different path, and/or
with different command-line options.

This enables the following use cases:
 - bugpoint llc against an llc command from a different build
 - bugpoint llc against the same llc with different command-line options
 - and more...

Also, document the existing "custom" interpreter options.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60681 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2008-12-08 04:02:47 +00:00
parent 28ea4f6c07
commit 70ef449741
5 changed files with 155 additions and 63 deletions

View File

@@ -277,7 +277,7 @@ static bool ExtractLoops(BugDriver &BD,
// we're going to test the newly loop extracted program to make sure nothing
// has broken. If something broke, then we'll inform the user and stop
// extraction.
AbstractInterpreter *AI = BD.switchToCBE();
AbstractInterpreter *AI = BD.switchToSafeInterpreter();
if (TestMergedProgram(BD, ToOptimizeLoopExtracted, ToNotOptimize, false)) {
BD.switchToInterpreter(AI);
@@ -838,13 +838,15 @@ static bool TestCodeGenerator(BugDriver &BD, Module *Test, Module *Safe) {
/// debugCodeGenerator - debug errors in LLC, LLI, or CBE.
///
bool BugDriver::debugCodeGenerator() {
if ((void*)cbe == (void*)Interpreter) {
std::string Result = executeProgramWithCBE("bugpoint.cbe.out");
std::cout << "\n*** The C backend cannot match the reference diff, but it "
<< "is used as the\n 'known good' code generator, so I can't"
<< " debug it. Perhaps you have a\n front-end problem? As a"
<< " sanity check, I left the result of executing the\n "
<< "program with the C backend in this file for you: '"
if ((void*)SafeInterpreter == (void*)Interpreter) {
std::string Result = executeProgramSafely("bugpoint.safe.out");
std::cout << "\n*** The \"safe\" i.e. 'known good' backend cannot match "
<< "the reference diff. This may be due to a\n front-end "
<< "bug or a bug in the original program, but this can also "
<< "happen if bugpoint isn't running the program with the "
<< "right flags or input.\n I left the result of executing "
<< "the program with the \"safe\" backend in this file for "
<< "you: '"
<< Result << "'.\n";
return true;
}