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

Chris Lattner lattner at cs.uiuc.edu
Sun Mar 14 15:23:01 PST 2004


Changes in directory llvm/tools/bugpoint:

OptimizerDriver.cpp updated: 1.19 -> 1.20
BugDriver.h updated: 1.34 -> 1.35

---
Log message:

Add a new "AutoDebugCrashes" option


---
Diffs of the changes:  (+17 -4)

Index: llvm/tools/bugpoint/OptimizerDriver.cpp
diff -u llvm/tools/bugpoint/OptimizerDriver.cpp:1.19 llvm/tools/bugpoint/OptimizerDriver.cpp:1.20
--- llvm/tools/bugpoint/OptimizerDriver.cpp:1.19	Sun Mar 14 15:17:03 2004
+++ llvm/tools/bugpoint/OptimizerDriver.cpp	Sun Mar 14 15:21:57 2004
@@ -16,6 +16,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "BugDriver.h"
+#include "llvm/Module.h"
 #include "llvm/PassManager.h"
 #include "llvm/Analysis/Verifier.h"
 #include "llvm/Bytecode/WriteBytecodePass.h"
@@ -166,11 +167,20 @@
 /// module, returning the transformed module on success, or a null pointer on
 /// failure.
 Module *BugDriver::runPassesOn(Module *M,
-                               const std::vector<const PassInfo*> &Passes) {
+                               const std::vector<const PassInfo*> &Passes,
+                               bool AutoDebugCrashes) {
   Module *OldProgram = swapProgramIn(M);
   std::string BytecodeResult;
-  if (runPasses(Passes, BytecodeResult, false/*delete*/, true/*quiet*/))
+  if (runPasses(Passes, BytecodeResult, false/*delete*/, true/*quiet*/)) {
+    if (AutoDebugCrashes) {
+      std::cerr << " Error running this sequence of passes" 
+                << " on the input program!\n";
+      delete OldProgram;
+      EmitProgressBytecode("pass-error",  false);
+      exit(debugOptimizerCrash());
+    }
     return 0;
+  }
 
   // Restore the current program.
   swapProgramIn(OldProgram);


Index: llvm/tools/bugpoint/BugDriver.h
diff -u llvm/tools/bugpoint/BugDriver.h:1.34 llvm/tools/bugpoint/BugDriver.h:1.35
--- llvm/tools/bugpoint/BugDriver.h:1.34	Sun Mar 14 15:17:03 2004
+++ llvm/tools/bugpoint/BugDriver.h	Sun Mar 14 15:21:57 2004
@@ -192,8 +192,11 @@
 
   /// runPassesOn - Carefully run the specified set of pass on the specified
   /// module, returning the transformed module on success, or a null pointer on
-  /// failure.
-  Module *runPassesOn(Module *M, const std::vector<const PassInfo*> &Passes);
+  /// failure.  If AutoDebugCrashes is set to true, then bugpoint will
+  /// automatically attempt to track down a crashing pass if one exists, and
+  /// this method will never return null.
+  Module *runPassesOn(Module *M, const std::vector<const PassInfo*> &Passes,
+                      bool AutoDebugCrashes = false);
 
   /// runPasses - Run the specified passes on Program, outputting a bytecode
   /// file and writting the filename into OutputFile if successful.  If the





More information about the llvm-commits mailing list