[llvm-commits] CVS: llvm/tools/bugpoint/BugDriver.cpp BugDriver.h ExecutionDriver.cpp OptimizerDriver.cpp bugpoint.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Jun 12 20:11:00 PDT 2006



Changes in directory llvm/tools/bugpoint:

BugDriver.cpp updated: 1.45 -> 1.46
BugDriver.h updated: 1.42 -> 1.43
ExecutionDriver.cpp updated: 1.60 -> 1.61
OptimizerDriver.cpp updated: 1.38 -> 1.39
bugpoint.cpp updated: 1.30 -> 1.31
---
Log message:

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!


---
Diffs of the changes:  (+14 -12)

 BugDriver.cpp       |    5 +++--
 BugDriver.h         |    3 ++-
 ExecutionDriver.cpp |    9 ++-------
 OptimizerDriver.cpp |    2 +-
 bugpoint.cpp        |    7 ++++++-
 5 files changed, 14 insertions(+), 12 deletions(-)


Index: llvm/tools/bugpoint/BugDriver.cpp
diff -u llvm/tools/bugpoint/BugDriver.cpp:1.45 llvm/tools/bugpoint/BugDriver.cpp:1.46
--- llvm/tools/bugpoint/BugDriver.cpp:1.45	Tue Jun  6 17:30:59 2006
+++ llvm/tools/bugpoint/BugDriver.cpp	Mon Jun 12 22:10:48 2006
@@ -62,9 +62,10 @@
   return Result;
 }
 
-BugDriver::BugDriver(const char *toolname, bool as_child)
+BugDriver::BugDriver(const char *toolname, bool as_child, unsigned timeout)
   : ToolName(toolname), ReferenceOutputFile(OutputFile),
-    Program(0), Interpreter(0), cbe(0), gcc(0), run_as_child(as_child) {}
+    Program(0), Interpreter(0), cbe(0), gcc(0), run_as_child(as_child),
+    Timeout(timeout) {}
 
 
 /// ParseInputFile - Given a bytecode or assembly input filename, parse and


Index: llvm/tools/bugpoint/BugDriver.h
diff -u llvm/tools/bugpoint/BugDriver.h:1.42 llvm/tools/bugpoint/BugDriver.h:1.43
--- llvm/tools/bugpoint/BugDriver.h:1.42	Thu Dec 22 14:02:55 2005
+++ llvm/tools/bugpoint/BugDriver.h	Mon Jun 12 22:10:48 2006
@@ -48,13 +48,14 @@
   CBE *cbe;
   GCC *gcc;
   bool run_as_child;
+  unsigned Timeout;
 
   // FIXME: sort out public/private distinctions...
   friend class ReducePassList;
   friend class ReduceMisCodegenFunctions;
 
 public:
-  BugDriver(const char *toolname, bool as_child);
+  BugDriver(const char *toolname, bool as_child, unsigned timeout);
 
   const std::string &getToolName() const { return ToolName; }
 


Index: llvm/tools/bugpoint/ExecutionDriver.cpp
diff -u llvm/tools/bugpoint/ExecutionDriver.cpp:1.60 llvm/tools/bugpoint/ExecutionDriver.cpp:1.61
--- llvm/tools/bugpoint/ExecutionDriver.cpp:1.60	Tue Jun  6 17:30:59 2006
+++ llvm/tools/bugpoint/ExecutionDriver.cpp	Mon Jun 12 22:10:48 2006
@@ -63,11 +63,6 @@
                 cl::desc("Additional shared objects to load "
                          "into executing programs"));
 
-  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"));
-
   cl::list<std::string>
     AdditionalLinkerArgs("Xlinker", 
       cl::desc("Additional arguments to pass to the linker"));
@@ -231,11 +226,11 @@
   if (InterpreterSel == RunLLC || InterpreterSel == RunCBE)
     RetVal = AI->ExecuteProgram(BytecodeFile, InputArgv, InputFile,
                                 OutputFile, AdditionalLinkerArgs, SharedObjs, 
-                                TimeoutValue);
+                                Timeout);
   else 
     RetVal = AI->ExecuteProgram(BytecodeFile, InputArgv, InputFile,
                                 OutputFile, std::vector<std::string>(), 
-                                SharedObjs, TimeoutValue);
+                                SharedObjs, Timeout);
 
   if (RetVal == -1) {
     std::cerr << "<timeout>";


Index: llvm/tools/bugpoint/OptimizerDriver.cpp
diff -u llvm/tools/bugpoint/OptimizerDriver.cpp:1.38 llvm/tools/bugpoint/OptimizerDriver.cpp:1.39
--- llvm/tools/bugpoint/OptimizerDriver.cpp:1.38	Sun May 14 14:11:40 2006
+++ llvm/tools/bugpoint/OptimizerDriver.cpp	Mon Jun 12 22:10:48 2006
@@ -179,7 +179,7 @@
   args[n++] = 0;
 
   sys::Path prog(sys::Program::FindProgramByName(ToolName));
-  int result = sys::Program::ExecuteAndWait(prog,args);
+  int result = sys::Program::ExecuteAndWait(prog,args,0,0,Timeout);
 
   // If we are supposed to delete the bytecode file or if the passes crashed,
   // remove it now.  This may fail if the file was never created, but that's ok.


Index: llvm/tools/bugpoint/bugpoint.cpp
diff -u llvm/tools/bugpoint/bugpoint.cpp:1.30 llvm/tools/bugpoint/bugpoint.cpp:1.31
--- llvm/tools/bugpoint/bugpoint.cpp:1.30	Wed Jun  7 18:06:50 2006
+++ llvm/tools/bugpoint/bugpoint.cpp	Mon Jun 12 22:10:48 2006
@@ -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());
 






More information about the llvm-commits mailing list