summaryrefslogtreecommitdiffstats
path: root/llvm/tools/bugpoint/CodeGeneratorBug.cpp
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2003-07-30 20:15:56 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2003-07-30 20:15:56 +0000
commit87154fdbc0e51b810c4f79d685dd21fff2682100 (patch)
tree2a8e0da2973f9afb5cc26f6902c3eba2b873ad9f /llvm/tools/bugpoint/CodeGeneratorBug.cpp
parent40feb36ffd94e7d2df5b9db32203e817cd2d850f (diff)
downloadbcm5719-llvm-87154fdbc0e51b810c4f79d685dd21fff2682100.tar.gz
bcm5719-llvm-87154fdbc0e51b810c4f79d685dd21fff2682100.zip
CodeGeneratorBug.cpp:
* Temporarily externing InputArgv to print it out for the benefit of LLI command needed to reproduce the result. * Print out the list of functions currently being tested * ListReducer now returns a bool if there was a failure, so test for it ListReducer.h: * Handle the case where there is no problem by returning true if failure is found. Also correctly handles the case when there is only 1 pass/function. Miscompilation.cpp: * ListReducer now returns a bool if there was a failure, so test for it llvm-svn: 7434
Diffstat (limited to 'llvm/tools/bugpoint/CodeGeneratorBug.cpp')
-rw-r--r--llvm/tools/bugpoint/CodeGeneratorBug.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/llvm/tools/bugpoint/CodeGeneratorBug.cpp b/llvm/tools/bugpoint/CodeGeneratorBug.cpp
index 597d580432e..abd940b34bf 100644
--- a/llvm/tools/bugpoint/CodeGeneratorBug.cpp
+++ b/llvm/tools/bugpoint/CodeGeneratorBug.cpp
@@ -20,11 +20,14 @@
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/Linker.h"
+#include "Support/CommandLine.h"
#include "Support/Statistic.h"
#include "Support/StringExtras.h"
#include <algorithm>
#include <set>
+extern cl::list<std::string> InputArgv;
+
class ReduceMisCodegenFunctions : public ListReducer<Function*> {
BugDriver &BD;
public:
@@ -47,10 +50,9 @@ public:
bool ReduceMisCodegenFunctions::TestFuncs(const std::vector<Function*> &Funcs,
bool KeepFiles)
{
- DEBUG(std::cerr << "Test functions are:\n");
- for (std::vector<Function*>::const_iterator I = Funcs.begin(),E = Funcs.end();
- I != E; ++I)
- DEBUG(std::cerr << "\t" << (*I)->getName() << "\n");
+ std::cout << "Testing functions: ";
+ BD.PrintFunctionList(Funcs);
+ std::cout << "\t";
// Clone the module for the two halves of the program we want.
Module *SafeModule = CloneModule(BD.Program);
@@ -150,7 +152,7 @@ bool ReduceMisCodegenFunctions::TestFuncs(const std::vector<Function*> &Funcs,
// cast the result from the resolver to correctly-typed function
CastInst *castResolver =
new CastInst(resolve, PointerType::get(F->getFunctionType()),
- "", Inst);
+ "resolverCast", Inst);
// actually use the resolved function
Inst->replaceUsesOfWith(F, castResolver);
} else {
@@ -227,8 +229,12 @@ bool ReduceMisCodegenFunctions::TestFuncs(const std::vector<Function*> &Funcs,
if (KeepFiles) {
std::cout << "You can reproduce the problem with the command line: \n"
<< (BD.isExecutingJIT() ? "lli" : "llc")
- << " -load " << SharedObject << " " << TestModuleBC
- << "\n";
+ << " -load " << SharedObject << " " << TestModuleBC;
+ for (unsigned i=0, e = InputArgv.size(); i != e; ++i)
+ std::cout << " " << InputArgv[i];
+ std::cout << "\n";
+ std::cout << "The shared object " << SharedObject << " was created from "
+ << SafeModuleBC << ", using `dis -c'.\n";
} else {
removeFile(TestModuleBC);
removeFile(SafeModuleBC);
@@ -346,7 +352,11 @@ bool BugDriver::debugCodeGenerator() {
DisambiguateGlobalSymbols(Program);
// Do the reduction...
- ReduceMisCodegenFunctions(*this).reduceList(MisCodegenFunctions);
+ if (!ReduceMisCodegenFunctions(*this).reduceList(MisCodegenFunctions)) {
+ std::cerr << "*** Execution matches reference output! No problem "
+ << "detected...\nbugpoint can't help you with your problem!\n";
+ return false;
+ }
std::cout << "\n*** The following functions are being miscompiled: ";
PrintFunctionList(MisCodegenFunctions);
OpenPOWER on IntegriCloud