From f9aaae06cd2109082cda2b09ef3f23e0e1cff47b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 2 Aug 2005 02:16:17 +0000 Subject: When the user hits ctrl-c, bugpoint should attempt to stop reduction as quickly as possible and output what it has so far. If they hit it twice, bugpoint is killed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22579 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/bugpoint/Miscompilation.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'tools/bugpoint/Miscompilation.cpp') diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index dc43126670..834e687995 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/tools/bugpoint/Miscompilation.cpp @@ -407,6 +407,8 @@ bool ReduceMiscompiledBlocks::TestFuncs(const std::vector &BBs) { static bool ExtractBlocks(BugDriver &BD, bool (*TestFn)(BugDriver &, Module *, Module *), std::vector &MiscompiledFunctions) { + if (BugpointIsInterrupted) return false; + std::vector Blocks; for (unsigned i = 0, e = MiscompiledFunctions.size(); i != e; ++i) for (Function::iterator I = MiscompiledFunctions[i]->begin(), @@ -493,7 +495,8 @@ DebugAMiscompilation(BugDriver &BD, MiscompiledFunctions.push_back(I); // Do the reduction... - ReduceMiscompilingFunctions(BD, TestFn).reduceList(MiscompiledFunctions); + if (!BugpointIsInterrupted) + ReduceMiscompilingFunctions(BD, TestFn).reduceList(MiscompiledFunctions); std::cout << "\n*** The following function" << (MiscompiledFunctions.size() == 1 ? " is" : "s are") @@ -513,7 +516,8 @@ DebugAMiscompilation(BugDriver &BD, DisambiguateGlobalSymbols(BD.getProgram()); // Do the reduction... - ReduceMiscompilingFunctions(BD, TestFn).reduceList(MiscompiledFunctions); + if (!BugpointIsInterrupted) + ReduceMiscompilingFunctions(BD, TestFn).reduceList(MiscompiledFunctions); std::cout << "\n*** The following function" << (MiscompiledFunctions.size() == 1 ? " is" : "s are") @@ -570,11 +574,12 @@ static bool TestOptimizer(BugDriver &BD, Module *Test, Module *Safe) { /// bool BugDriver::debugMiscompilation() { // Make sure something was miscompiled... - if (!ReduceMiscompilingPasses(*this).reduceList(PassesToRun)) { - std::cerr << "*** Optimized program matches reference output! No problem " - << "detected...\nbugpoint can't help you with your problem!\n"; - return false; - } + if (!BugpointIsInterrupted) + if (!ReduceMiscompilingPasses(*this).reduceList(PassesToRun)) { + std::cerr << "*** Optimized program matches reference output! No problem" + << " detected...\nbugpoint can't help you with your problem!\n"; + return false; + } std::cout << "\n*** Found miscompiling pass" << (getPassesToRun().size() == 1 ? "" : "es") << ": " @@ -663,7 +668,7 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, for (Module::iterator F = Safe->begin(), E = Safe->end(); F != E; ++F) { if (F->isExternal() && !F->use_empty() && &*F != resolverFunc && F->getIntrinsicID() == 0 /* ignore intrinsics */) { - Function *TestFn = Test->getFunction(F->getName(), F->getFunctionType()); + Function *TestFn = Test->getNamedFunction(F->getName()); // Don't forward functions which are external in the test module too. if (TestFn && !TestFn->isExternal()) { -- cgit v1.2.3-70-g09d2