For transforms the behave differently if main goes away, add an option to prevent bugpoint from removing main

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26557 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andrew Lenharth 2006-03-05 22:21:36 +00:00
parent 3d68e15c20
commit 7c0a93785e

View File

@ -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 <fstream>
#include <set>
using namespace llvm;
namespace {
cl::opt<bool>
KeepMain("keep-main",
cl::desc("Force function reduction to keep main"),
cl::init(false));
}
namespace llvm {
class ReducePassList : public ListReducer<const PassInfo*> {
BugDriver &BD;
@ -109,6 +117,11 @@ namespace llvm {
}
bool ReduceCrashingFunctions::TestFuncs(std::vector<Function*> &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());