[llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Apr 24 19:54:05 PDT 2003
Changes in directory llvm/tools/bugpoint:
CrashDebugger.cpp updated: 1.8 -> 1.9
---
Log message:
Big programs have tons of global variable initializers, and most passes don't care
about them. Try to delete them if it doesn't affect the passes.
---
Diffs of the changes:
Index: llvm/tools/bugpoint/CrashDebugger.cpp
diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.8 llvm/tools/bugpoint/CrashDebugger.cpp:1.9
--- llvm/tools/bugpoint/CrashDebugger.cpp:1.8 Thu Apr 24 18:51:38 2003
+++ llvm/tools/bugpoint/CrashDebugger.cpp Thu Apr 24 19:53:05 2003
@@ -244,6 +244,36 @@
<< getPassesString(PassesToRun) << "\n";
EmitProgressBytecode("passinput");
+
+ // See if we can get away with nuking all of the global variable initializers
+ // in the program...
+ if (Program->gbegin() != Program->gend()) {
+ Module *M = CloneModule(Program);
+ bool DeletedInit = false;
+ for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
+ if (I->hasInitializer()) {
+ I->setInitializer(0);
+ I->setLinkage(GlobalValue::ExternalLinkage);
+ DeletedInit = true;
+ }
+
+ if (!DeletedInit) {
+ delete M; // No change made...
+ } else {
+ // See if the program still causes a crash...
+ std::cout << "\nChecking to see if we can delete global inits: ";
+ std::swap(Program, M);
+ if (runPasses(PassesToRun)) { // Still crashes?
+ AnyReduction = true;
+ delete M;
+ std::cout << "\n*** Able to remove all global initializers!\n";
+ } else { // No longer crashes?
+ delete Program; // Restore program.
+ Program = M;
+ std::cout << " - Removing all global inits hides problem!\n";
+ }
+ }
+ }
// Now try to reduce the number of functions in the module to something small.
std::vector<Function*> Functions;
More information about the llvm-commits
mailing list