Teach bugpoint to kill optimization passes that run over the timeout limit,
which allows it to debug optimizer infinite loops. This patch is contributed
by Nick Lewycky, thanks!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28763 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/bugpoint/bugpoint.cpp b/tools/bugpoint/bugpoint.cpp
index 21a4623..cc05fea 100644
--- a/tools/bugpoint/bugpoint.cpp
+++ b/tools/bugpoint/bugpoint.cpp
@@ -36,6 +36,11 @@
InputFilenames(cl::Positional, cl::OneOrMore,
cl::desc("<input llvm ll/bc files>"));
+static cl::opt<unsigned>
+TimeoutValue("timeout", cl::init(300), cl::value_desc("seconds"),
+ cl::desc("Number of seconds program is allowed to run before it "
+ "is killed (default is 300s), 0 disables timeout"));
+
// The AnalysesList is automatically populated with registered Passes by the
// PassNameParser.
//
@@ -57,7 +62,7 @@
sys::PrintStackTraceOnErrorSignal();
sys::SetInterruptFunction(BugpointInterruptFunction);
- BugDriver D(argv[0],AsChild);
+ BugDriver D(argv[0],AsChild,TimeoutValue);
if (D.addSources(InputFilenames)) return 1;
D.addPasses(PassList.begin(), PassList.end());