The big fix is this change:

-    if (I->isExternal() && !Functions.count(I))
+    if (!I->isExternal() && !Functions.count(I))

We were not actually deleting any functions from the module!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5914 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-04-24 22:54:06 +00:00
parent 44be257166
commit f607b79bc7

View File

@ -87,7 +87,7 @@ bool ReduceCrashingFunctions::TestFuncs(std::vector<Function*> &Funcs) {
Function *CMF = M->getFunction(Funcs[i]->getName(), Function *CMF = M->getFunction(Funcs[i]->getName(),
Funcs[i]->getFunctionType()); Funcs[i]->getFunctionType());
assert(CMF && "Function not in module?!"); assert(CMF && "Function not in module?!");
Functions.insert(CMF); Functions.insert(CMF);
} }
std::cout << "Checking for crash with only these functions:"; std::cout << "Checking for crash with only these functions:";
@ -98,7 +98,7 @@ bool ReduceCrashingFunctions::TestFuncs(std::vector<Function*> &Funcs) {
// Loop over and delete any functions which we aren't supposed to be playing // Loop over and delete any functions which we aren't supposed to be playing
// with... // with...
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
if (I->isExternal() && !Functions.count(I)) if (!I->isExternal() && !Functions.count(I))
DeleteFunctionBody(I); DeleteFunctionBody(I);
// Try running the hacked up program... // Try running the hacked up program...
@ -129,11 +129,6 @@ bool BugDriver::debugCrash() {
unsigned OldSize = PassesToRun.size(); unsigned OldSize = PassesToRun.size();
DebugCrashes(*this).reduceList(PassesToRun); DebugCrashes(*this).reduceList(PassesToRun);
if (PassesToRun.size() == OldSize) { // Make sure something crashed. :)
std::cerr << "ERROR: No passes crashed!\n";
return true;
}
std::cout << "\n*** Found crashing pass" std::cout << "\n*** Found crashing pass"
<< (PassesToRun.size() == 1 ? ": " : "es: ") << (PassesToRun.size() == 1 ? ": " : "es: ")
<< getPassesString(PassesToRun) << "\n"; << getPassesString(PassesToRun) << "\n";
@ -164,7 +159,6 @@ bool BugDriver::debugCrash() {
// FIXME: This should use the list reducer to converge faster by deleting // FIXME: This should use the list reducer to converge faster by deleting
// larger chunks of instructions at a time! // larger chunks of instructions at a time!
bool Reduced = false;
unsigned Simplification = 4; unsigned Simplification = 4;
do { do {
--Simplification; --Simplification;
@ -200,7 +194,7 @@ bool BugDriver::debugCrash() {
// Yup, it does, we delete the old module, and continue trying to // Yup, it does, we delete the old module, and continue trying to
// reduce the testcase... // reduce the testcase...
delete M; delete M;
Reduced = AnyReduction = true; AnyReduction = true;
goto TryAgain; // I wish I had a multi-level break here! goto TryAgain; // I wish I had a multi-level break here!
} }
@ -222,17 +216,15 @@ bool BugDriver::debugCrash() {
if (runPasses(PassesToRun)) { if (runPasses(PassesToRun)) {
// Yup, it does, keep the reduced version... // Yup, it does, keep the reduced version...
delete M; delete M;
Reduced = AnyReduction = true; AnyReduction = true;
} else { } else {
delete Program; // Otherwise, restore the original module... delete Program; // Otherwise, restore the original module...
Program = M; Program = M;
} }
} }
if (Reduced) { if (AnyReduction)
EmitProgressBytecode("reduced-simplified"); EmitProgressBytecode("reduced-simplified");
Reduced = false;
}
return false; return false;
} }