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

Chris Lattner lattner at cs.uiuc.edu
Fri Feb 28 10:14:01 PST 2003


Changes in directory llvm/tools/bugpoint:

BugDriver.h updated: 1.3 -> 1.4
CrashDebugger.cpp updated: 1.3 -> 1.4
ExtractFunction.cpp updated: 1.2 -> 1.3

---
Log message:

* Reduce the number of useless bytecode files produced by bugpoint.
  - This also speeds it up as the bytecode writer isn't terribly fast.
* Add a new cleanup pass after everything else to run -funcresolve -globaldce



---
Diffs of the changes:

Index: llvm/tools/bugpoint/BugDriver.h
diff -u llvm/tools/bugpoint/BugDriver.h:1.3 llvm/tools/bugpoint/BugDriver.h:1.4
--- llvm/tools/bugpoint/BugDriver.h:1.3	Wed Jan 22 20:48:33 2003
+++ llvm/tools/bugpoint/BugDriver.h	Fri Feb 28 10:13:20 2003
@@ -125,6 +125,12 @@
   ///
   Module *deleteInstructionFromProgram(Instruction *I, unsigned Simp) const;
 
+  /// performFinalCleanups - This method clones the current Program and performs
+  /// a series of cleanups intended to get rid of extra cruft on the module
+  /// before handing it to the user...
+  ///
+  Module *performFinalCleanups() const;
+
   /// initializeExecutionEnvironment - This method is used to set up the
   /// environment for executing LLVM programs.
   ///


Index: llvm/tools/bugpoint/CrashDebugger.cpp
diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.3 llvm/tools/bugpoint/CrashDebugger.cpp:1.4
--- llvm/tools/bugpoint/CrashDebugger.cpp:1.3	Wed Jan 22 20:48:33 2003
+++ llvm/tools/bugpoint/CrashDebugger.cpp	Fri Feb 28 10:13:20 2003
@@ -84,6 +84,7 @@
 ///
 bool BugDriver::debugPassCrash(const PassInfo *Pass) {
   EmitProgressBytecode(Pass, "passinput");
+  bool Reduced = false, AnyReduction = false;
 
   if (CountFunctions(Program) > 1) {
     // Attempt to reduce the input program down to a single function that still
@@ -106,7 +107,7 @@
           // reduce the testcase...
           delete M;
 
-          EmitProgressBytecode(Pass, "reduced-"+I->getName());
+          Reduced = AnyReduction = true;
           break;
         }
         
@@ -122,6 +123,11 @@
     }
   }
 
+  if (Reduced) {
+    EmitProgressBytecode(Pass, "reduced-function");
+    Reduced = false;
+  }
+
   // FIXME: This should attempt to delete entire basic blocks at a time to speed
   // up convergence...
 
@@ -159,8 +165,8 @@
             if (runPass(Pass)) {
               // Yup, it does, we delete the old module, and continue trying to
               // reduce the testcase...
-              EmitProgressBytecode(Pass, "reduced-" + I->getName());
               delete M;
+              Reduced = AnyReduction = true;
               goto TryAgain;  // I wish I had a multi-level break here!
             }
             
@@ -171,6 +177,28 @@
           }
       }
   } while (Simplification);
-  
+
+  // Try to clean up the testcase by running funcresolve and globaldce...
+  if (AnyReduction) {
+    std::cout << "\n*** Attempting to perform final cleanups: ";
+    Module *M = performFinalCleanups();
+    std::swap(Program, M);
+            
+    // Find out if the pass still crashes on the cleaned up program...
+    if (runPass(Pass)) {
+      // Yup, it does, keep the reduced version...
+      delete M;
+      Reduced = AnyReduction = true;
+    } else {
+      delete Program;   // Otherwise, restore the original module...
+      Program = M;
+    }
+  }
+
+  if (Reduced) {
+    EmitProgressBytecode(Pass, "reduced-simplified");
+    Reduced = false;
+  }
+
   return false;
 }


Index: llvm/tools/bugpoint/ExtractFunction.cpp
diff -u llvm/tools/bugpoint/ExtractFunction.cpp:1.2 llvm/tools/bugpoint/ExtractFunction.cpp:1.3
--- llvm/tools/bugpoint/ExtractFunction.cpp:1.2	Wed Jan 22 20:48:33 2003
+++ llvm/tools/bugpoint/ExtractFunction.cpp	Fri Feb 28 10:13:20 2003
@@ -81,3 +81,16 @@
   Passes.run(*Result);
   return Result;
 }
+
+/// performFinalCleanups - This method clones the current Program and performs
+/// a series of cleanups intended to get rid of extra cruft on the module
+/// before handing it to the user...
+///
+Module *BugDriver::performFinalCleanups() const {
+  PassManager CleanupPasses;
+  CleanupPasses.add(createFunctionResolvingPass());
+  CleanupPasses.add(createGlobalDCEPass());
+  Module *M = CloneModule(Program);
+  CleanupPasses.run(*M);
+  return M;
+}





More information about the llvm-commits mailing list