[llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp Miscompilation.cpp
Changes in directory llvm/tools/bugpoint: CrashDebugger.cpp updated: 1.56 -> 1.57 Miscompilation.cpp updated: 1.86 -> 1.87 --- Log message: For PR411: http://llvm.org/PR411 : Adjust to changes in Module interface: getMainFunction() -> getFunction("main") getNamedFunction(X) -> getFunction(X) --- Diffs of the changes: (+3 -3) CrashDebugger.cpp |2 +- Miscompilation.cpp |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.56 llvm/tools/bugpoint/CrashDebugger.cpp:1.57 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.56 Mon Feb 5 14:47:21 2007 +++ llvm/tools/bugpoint/CrashDebugger.cpp Mon Feb 5 15:19:13 2007 @@ -194,7 +194,7 @@ //if main isn't present, claim there is no problem if (KeepMain && find(Funcs.begin(), Funcs.end(), - BD.getProgram()->getMainFunction()) == Funcs.end()) + BD.getProgram()->getFunction("main")) == Funcs.end()) return false; // Clone the program to try hacking it apart... Index: llvm/tools/bugpoint/Miscompilation.cpp diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.86 llvm/tools/bugpoint/Miscompilation.cpp:1.87 --- llvm/tools/bugpoint/Miscompilation.cpp:1.86 Mon Feb 5 14:47:21 2007 +++ llvm/tools/bugpoint/Miscompilation.cpp Mon Feb 5 15:19:13 2007 @@ -639,7 +639,7 @@ // First, if the main function is in the Safe module, we must add a stub to // the Test module to call into it. Thus, we create a new function `main' // which just calls the old one. - if (Function *oldMain = Safe->getNamedFunction("main")) + if (Function *oldMain = Safe->getFunction("main")) if (!oldMain->isDeclaration()) { // Rename it oldMain->setName("llvm_bugpoint_old_main"); @@ -685,7 +685,7 @@ for (Module::iterator F = Safe->begin(), E = Safe->end(); F != E; ++F) { if (F->isDeclaration() && !F->use_empty() && &*F != resolverFunc && F->getIntrinsicID() == 0 /* ignore intrinsics */) { - Function *TestFn = Test->getNamedFunction(F->getName()); + Function *TestFn = Test->getFunction(F->getName()); // Don't forward functions which are external in the test module too. if (TestFn && !TestFn->isDeclaration()) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp ExtractFunction.cpp Miscompilation.cpp
Changes in directory llvm/tools/bugpoint: CrashDebugger.cpp updated: 1.55 -> 1.56 ExtractFunction.cpp updated: 1.57 -> 1.58 Miscompilation.cpp updated: 1.85 -> 1.86 --- Log message: For PR411: http://llvm.org/PR411 : This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. --- Diffs of the changes: (+21 -17) CrashDebugger.cpp | 17 + ExtractFunction.cpp | 10 +- Miscompilation.cpp | 11 +++ 3 files changed, 21 insertions(+), 17 deletions(-) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.55 llvm/tools/bugpoint/CrashDebugger.cpp:1.56 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.55 Tue Jan 30 14:08:38 2007 +++ llvm/tools/bugpoint/CrashDebugger.cpp Mon Feb 5 14:47:21 2007 @@ -20,7 +20,7 @@ #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/PassManager.h" -#include "llvm/SymbolTable.h" +#include "llvm/ValueSymbolTable.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Bytecode/Writer.h" #include "llvm/Support/CFG.h" @@ -206,9 +206,9 @@ // FIXME: bugpoint should add names to all stripped symbols. assert(!Funcs[i]->getName().empty() && "Bugpoint doesn't work on stripped modules yet PR718!"); -Function *CMF = M->getFunction(Funcs[i]->getName(), - Funcs[i]->getFunctionType()); +Function *CMF = M->getFunction(Funcs[i]->getName()); assert(CMF && "Function not in module?!"); +assert(CMF->getFunctionType() == Funcs[i]->getFunctionType() && "wrong ty"); Functions.insert(CMF); } @@ -271,8 +271,9 @@ for (unsigned i = 0, e = BBs.size(); i != e; ++i) { // Convert the basic block from the original module to the new module... const Function *F = BBs[i]->getParent(); -Function *CMF = M->getFunction(F->getName(), F->getFunctionType()); +Function *CMF = M->getFunction(F->getName()); assert(CMF && "Function not in module?!"); +assert(CMF->getFunctionType() == F->getFunctionType() && "wrong type?"); // Get the mapped basic block... Function::iterator CBI = CMF->begin(); @@ -337,10 +338,10 @@ // module, and that they don't include any deleted blocks. BBs.clear(); for (unsigned i = 0, e = BlockInfo.size(); i != e; ++i) { - SymbolTable &ST = BlockInfo[i].first->getValueSymbolTable(); - SymbolTable::plane_iterator PI = ST.find(Type::LabelTy); - if (PI != ST.plane_end() && PI->second.count(BlockInfo[i].second)) -BBs.push_back(cast(PI->second[BlockInfo[i].second])); + ValueSymbolTable &ST = BlockInfo[i].first->getValueSymbolTable(); + Value* V = ST.lookup(BlockInfo[i].second); + if (V && V->getType() == Type::LabelTy) +BBs.push_back(cast(V)); } return true; } Index: llvm/tools/bugpoint/ExtractFunction.cpp diff -u llvm/tools/bugpoint/ExtractFunction.cpp:1.57 llvm/tools/bugpoint/ExtractFunction.cpp:1.58 --- llvm/tools/bugpoint/ExtractFunction.cpp:1.57Tue Jan 30 14:08:38 2007 +++ llvm/tools/bugpoint/ExtractFunction.cpp Mon Feb 5 14:47:21 2007 @@ -110,7 +110,6 @@ I->setLinkage(GlobalValue::ExternalLinkage); std::vector CleanupPasses; - CleanupPasses.push_back(getPI(createFunctionResolvingPass())); CleanupPasses.push_back(getPI(createGlobalDCEPass())); CleanupPasses.push_back(getPI(createDeadTypeEliminationPass())); @@ -221,7 +220,7 @@ M1Tors.push_back(std::make_pair(F, Priority)); else { // Map to M2's version of the function. - F = M2->getFunction(F->getName(), F->getFunctionType()); + F = M2->getFunction(F->getName()); M2Tors.push_back(std::make_pair(F, Priority)); } } @@ -272,9 +271,10 @@ std::set > TestFunctions; for (unsigned i = 0, e = F.size(); i != e; ++i) { TestFunctions.insert(std::make_pair(F[i]->getName(), F[i]->getType())); -Function *TNOF = M->getFunction(F[i]->getName(), F[i]->getFunctionType()); -DEBUG(std::cerr << "Removing function " << F[i]->getName() << "\n"); +Function *TNOF = M->getFunction(F[i]->getName()); assert(TNOF && "Function doesn't exist in module!"); +assert(TNOF->getFunctionType() == F[i]->getFunctionType() && "wrong type?"); +DEBUG(std::cerr << "Removing function " << F[i]->getName() << "\n"); DeleteFunctionBody(TNOF); // Function is now external in this module! } @@ -317,7 +317,7 @@ Function *F = BB->getParent(); // Map the corresponding function in this module. -Function *MF = M.getFunction(F->getName(), F->getFunctionType()); +Function *MF = M.getFunction(F->getName()); // Figure out which index the ba
[llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp ExtractFunction.cpp Miscompilation.cpp
Changes in directory llvm/tools/bugpoint: CrashDebugger.cpp updated: 1.54 -> 1.55 ExtractFunction.cpp updated: 1.56 -> 1.57 Miscompilation.cpp updated: 1.84 -> 1.85 --- Log message: For PR1136: http://llvm.org/PR1136 : Rename GlobalVariable::isExternal as isDeclaration to avoid confusion with external linkage types. --- Diffs of the changes: (+12 -12) CrashDebugger.cpp |6 +++--- ExtractFunction.cpp |6 +++--- Miscompilation.cpp | 12 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.54 llvm/tools/bugpoint/CrashDebugger.cpp:1.55 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.54 Sat Jan 6 01:24:44 2007 +++ llvm/tools/bugpoint/CrashDebugger.cpp Tue Jan 30 14:08:38 2007 @@ -219,7 +219,7 @@ // Loop over and delete any functions which we aren't supposed to be playing // with... for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) -if (!I->isExternal() && !Functions.count(I)) +if (!I->isDeclaration() && !Functions.count(I)) DeleteFunctionBody(I); // Try running the hacked up program... @@ -406,7 +406,7 @@ std::vector Functions; for (Module::iterator I = BD.getProgram()->begin(), E = BD.getProgram()->end(); I != E; ++I) -if (!I->isExternal()) +if (!I->isDeclaration()) Functions.push_back(I); if (Functions.size() > 1 && !BugpointIsInterrupted) { @@ -459,7 +459,7 @@ unsigned CurInstructionNum = 0; for (Module::const_iterator FI = BD.getProgram()->begin(), E = BD.getProgram()->end(); FI != E; ++FI) - if (!FI->isExternal()) + if (!FI->isDeclaration()) for (Function::const_iterator BI = FI->begin(), E = FI->end(); BI != E; ++BI) for (BasicBlock::const_iterator I = BI->begin(), E = --BI->end(); Index: llvm/tools/bugpoint/ExtractFunction.cpp diff -u llvm/tools/bugpoint/ExtractFunction.cpp:1.56 llvm/tools/bugpoint/ExtractFunction.cpp:1.57 --- llvm/tools/bugpoint/ExtractFunction.cpp:1.56Sun Dec 31 00:02:26 2006 +++ llvm/tools/bugpoint/ExtractFunction.cpp Tue Jan 30 14:08:38 2007 @@ -170,7 +170,7 @@ void llvm::DeleteFunctionBody(Function *F) { // delete the body of the function... F->deleteBody(); - assert(F->isExternal() && "This didn't make the function external!"); + assert(F->isDeclaration() && "This didn't make the function external!"); } /// GetTorInit - Given a list of entries for static ctors/dtors, return them @@ -195,7 +195,7 @@ /// prune appropriate entries out of M1s list. static void SplitStaticCtorDtor(const char *GlobalName, Module *M1, Module *M2){ GlobalVariable *GV = M1->getNamedGlobal(GlobalName); - if (!GV || GV->isExternal() || GV->hasInternalLinkage() || + if (!GV || GV->isDeclaration() || GV->hasInternalLinkage() || !GV->use_empty()) return; std::vector > M1Tors, M2Tors; @@ -217,7 +217,7 @@ if (CE->isCast()) FP = CE->getOperand(0); if (Function *F = dyn_cast(FP)) { -if (!F->isExternal()) +if (!F->isDeclaration()) M1Tors.push_back(std::make_pair(F, Priority)); else { // Map to M2's version of the function. Index: llvm/tools/bugpoint/Miscompilation.cpp diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.84 llvm/tools/bugpoint/Miscompilation.cpp:1.85 --- llvm/tools/bugpoint/Miscompilation.cpp:1.84 Sun Jan 7 02:13:39 2007 +++ llvm/tools/bugpoint/Miscompilation.cpp Tue Jan 30 14:08:38 2007 @@ -320,7 +320,7 @@ std::vector > MisCompFunctions; for (Module::iterator I = ToOptimizeLoopExtracted->begin(), E = ToOptimizeLoopExtracted->end(); I != E; ++I) - if (!I->isExternal()) + if (!I->isDeclaration()) MisCompFunctions.push_back(std::make_pair(I->getName(), I->getFunctionType())); @@ -460,7 +460,7 @@ std::vector > MisCompFunctions; for (Module::iterator I = Extracted->begin(), E = Extracted->end(); I != E; ++I) -if (!I->isExternal()) +if (!I->isDeclaration()) MisCompFunctions.push_back(std::make_pair(I->getName(), I->getFunctionType())); @@ -502,7 +502,7 @@ std::vector MiscompiledFunctions; Module *Prog = BD.getProgram(); for (Module::iterator I = Prog->begin(), E = Prog->end(); I != E; ++I) -if (!I->isExternal()) +if (!I->isDeclaration()) MiscompiledFunctions.push_back(I); // Do the reduction... @@ -637,7 +637,7 @@ // the Test module to call into it. Thus, we create a new function `main' // which just calls the old one. if (Function *oldMain = Safe->getNamedFunction("main")) -if (!oldMain->isExternal()) { +if (!oldMain->isDeclaration()) { // Rename it oldMain->setName("llvm_bugpoint_old_main"); // Create a NEW `main' function with same type in the test module. @@ -680,
[llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp
Changes in directory llvm/tools/bugpoint: CrashDebugger.cpp updated: 1.53 -> 1.54 --- Log message: For PR411: http://llvm.org/PR411 : Take an incremental step towards type plane elimination. This change separates types from values in the symbol tables by finally making use of the TypeSymbolTable class. This yields more natural interfaces for dealing with types and unclutters the SymbolTable class. --- Diffs of the changes: (+1 -1) CrashDebugger.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.53 llvm/tools/bugpoint/CrashDebugger.cpp:1.54 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.53 Thu Nov 2 14:25:50 2006 +++ llvm/tools/bugpoint/CrashDebugger.cpp Sat Jan 6 01:24:44 2007 @@ -337,7 +337,7 @@ // module, and that they don't include any deleted blocks. BBs.clear(); for (unsigned i = 0, e = BlockInfo.size(); i != e; ++i) { - SymbolTable &ST = BlockInfo[i].first->getSymbolTable(); + SymbolTable &ST = BlockInfo[i].first->getValueSymbolTable(); SymbolTable::plane_iterator PI = ST.find(Type::LabelTy); if (PI != ST.plane_end() && PI->second.count(BlockInfo[i].second)) BBs.push_back(cast(PI->second[BlockInfo[i].second])); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp Miscompilation.cpp
Changes in directory llvm/tools/bugpoint: CrashDebugger.cpp updated: 1.52 -> 1.53 Miscompilation.cpp updated: 1.77 -> 1.78 --- Log message: For PR786: http://llvm.org/PR786 : Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting fall out by removing unused variables. Remaining warnings have to do with unused functions (I didn't want to delete code without review) and unused variables in generated code. Maintainers should clean up the remaining issues when they see them. All changes pass DejaGnu tests and Olden. --- Diffs of the changes: (+1 -2) CrashDebugger.cpp |1 - Miscompilation.cpp |2 +- 2 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.52 llvm/tools/bugpoint/CrashDebugger.cpp:1.53 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.52 Fri Oct 27 15:22:04 2006 +++ llvm/tools/bugpoint/CrashDebugger.cpp Thu Nov 2 14:25:50 2006 @@ -525,7 +525,6 @@ std::cout << "\n*** Debugging optimizer crash!\n"; // Reduce the list of passes which causes the optimizer to crash... - unsigned OldSize = PassesToRun.size(); if (!BugpointIsInterrupted) ReducePassList(*this).reduceList(PassesToRun); Index: llvm/tools/bugpoint/Miscompilation.cpp diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.77 llvm/tools/bugpoint/Miscompilation.cpp:1.78 --- llvm/tools/bugpoint/Miscompilation.cpp:1.77 Thu Sep 7 13:21:07 2006 +++ llvm/tools/bugpoint/Miscompilation.cpp Thu Nov 2 14:25:50 2006 @@ -747,7 +747,7 @@ // Pass on the arguments to the real function, return its result if (F->getReturnType() == Type::VoidTy) { -CallInst *Call = new CallInst(FuncPtr, Args, "", DoCallBB); +new CallInst(FuncPtr, Args, "", DoCallBB); new ReturnInst(DoCallBB); } else { CallInst *Call = new CallInst(FuncPtr, Args, "retval", DoCallBB); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp
Changes in directory llvm/tools/bugpoint: CrashDebugger.cpp updated: 1.50 -> 1.51 --- Log message: Re-added the part where it tries to remove all global variables first. --- Diffs of the changes: (+38 -13) CrashDebugger.cpp | 51 ++- 1 files changed, 38 insertions(+), 13 deletions(-) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.50 llvm/tools/bugpoint/CrashDebugger.cpp:1.51 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.50 Wed Oct 25 13:36:14 2006 +++ llvm/tools/bugpoint/CrashDebugger.cpp Fri Oct 27 15:18:06 2006 @@ -357,22 +357,47 @@ if (BD.getProgram()->global_begin() != BD.getProgram()->global_end()) { // Now try to reduce the number of global variable initializers in the // module to something small. -std::vector GVs; +Module *M = CloneModule(BD.getProgram()); +bool DeletedInit = false; -for (Module::global_iterator I = BD.getProgram()->global_begin(), - E = BD.getProgram()->global_end(); I != E; ++I) - if (I->hasInitializer()) -GVs.push_back(I); - -if (GVs.size() > 1 && !BugpointIsInterrupted) { - std::cout << "\n*** Attempting to reduce the number of global variables " -<< "in the testcase\n"; +for (Module::global_iterator I = M->global_begin(), E = M->global_end(); + I != E; ++I) + if (I->hasInitializer()) { +I->setInitializer(0); +I->setLinkage(GlobalValue::ExternalLinkage); +DeletedInit = true; + } - unsigned OldSize = GVs.size(); - ReduceCrashingGlobalVariables(BD, TestFn).reduceList(GVs); +if (!DeletedInit) { + delete M; // No change made... +} else { + // See if the program still causes a crash... + std::cout << "\nChecking to see if we can delete global inits: "; - if (GVs.size() < OldSize) -BD.EmitProgressBytecode("reduced-global-variables"); + if (TestFn(BD, M)) { // Still crashes? +BD.setNewProgram(M); +std::cout << "\n*** Able to remove all global initializers!\n"; + } else { // No longer crashes? +std::cout << " - Removing all global inits hides problem!\n"; +delete M; + +std::vector GVs; + +for (Module::global_iterator I = BD.getProgram()->global_begin(), + E = BD.getProgram()->global_end(); I != E; ++I) + if (I->hasInitializer()) +GVs.push_back(I); + +if (GVs.size() > 1 && !BugpointIsInterrupted) { + std::cout << "\n*** Attempting to reduce the number of global " +<< "variables in the testcase\n"; + + unsigned OldSize = GVs.size(); + ReduceCrashingGlobalVariables(BD, TestFn).reduceList(GVs); + + if (GVs.size() < OldSize) +BD.EmitProgressBytecode("reduced-global-variables"); +} } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp
Changes in directory llvm/tools/bugpoint: CrashDebugger.cpp updated: 1.51 -> 1.52 --- Log message: Forgot a } --- Diffs of the changes: (+1 -0) CrashDebugger.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.51 llvm/tools/bugpoint/CrashDebugger.cpp:1.52 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.51 Fri Oct 27 15:18:06 2006 +++ llvm/tools/bugpoint/CrashDebugger.cpp Fri Oct 27 15:22:04 2006 @@ -398,6 +398,7 @@ if (GVs.size() < OldSize) BD.EmitProgressBytecode("reduced-global-variables"); } + } } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp
Changes in directory llvm/tools/bugpoint: CrashDebugger.cpp updated: 1.46 -> 1.47 --- Log message: add an assert to get a slightly better msg about this problem --- Diffs of the changes: (+3 -0) CrashDebugger.cpp |3 +++ 1 files changed, 3 insertions(+) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.46 llvm/tools/bugpoint/CrashDebugger.cpp:1.47 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.46 Sun Mar 5 16:21:36 2006 +++ llvm/tools/bugpoint/CrashDebugger.cpp Thu Mar 16 17:16:17 2006 @@ -128,6 +128,9 @@ // Convert list to set for fast lookup... std::set Functions; for (unsigned i = 0, e = Funcs.size(); i != e; ++i) { +// FIXME: bugpoint should add names to all stripped symbols. +assert(!Funcs[i]->getName().empty() && + "Bugpoint doesn't work on stripped modules yet PR718!"); Function *CMF = M->getFunction(Funcs[i]->getName(), Funcs[i]->getFunctionType()); assert(CMF && "Function not in module?!"); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp
Changes in directory llvm/tools/bugpoint: CrashDebugger.cpp updated: 1.45 -> 1.46 --- Log message: For transforms the behave differently if main goes away, add an option to prevent bugpoint from removing main --- Diffs of the changes: (+13 -0) CrashDebugger.cpp | 13 + 1 files changed, 13 insertions(+) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.45 llvm/tools/bugpoint/CrashDebugger.cpp:1.46 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.45 Mon Aug 1 21:16:17 2005 +++ llvm/tools/bugpoint/CrashDebugger.cpp Sun Mar 5 16:21:36 2006 @@ -27,10 +27,18 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Support/FileUtilities.h" +#include "llvm/Support/CommandLine.h" #include #include using namespace llvm; +namespace { + cl::opt + KeepMain("keep-main", + cl::desc("Force function reduction to keep main"), + cl::init(false)); +} + namespace llvm { class ReducePassList : public ListReducer { BugDriver &BD; @@ -109,6 +117,11 @@ } bool ReduceCrashingFunctions::TestFuncs(std::vector &Funcs) { + + //if main isn't present, claim there is no problem + if (KeepMain && find(Funcs.begin(), Funcs.end(), BD.getProgram()->getMainFunction()) == Funcs.end()) +return false; + // Clone the program to try hacking it apart... Module *M = CloneModule(BD.getProgram()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits