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/ListReducer.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tools/bugpoint/ListReducer.h') diff --git a/tools/bugpoint/ListReducer.h b/tools/bugpoint/ListReducer.h index daeadba..ff2a11d 100644 --- a/tools/bugpoint/ListReducer.h +++ b/tools/bugpoint/ListReducer.h @@ -19,6 +19,8 @@ #include namespace llvm { + + extern bool BugpointIsInterrupted; template struct ListReducer { @@ -62,6 +64,12 @@ struct ListReducer { unsigned MidTop = TheList.size(); while (MidTop > 1) { + // Halt if the user presses ctrl-c. + if (BugpointIsInterrupted) { + std::cerr << "\n\n*** Reduction Interrupted, cleaning up...\n\n"; + return true; + } + unsigned Mid = MidTop / 2; std::vector Prefix(TheList.begin(), TheList.begin()+Mid); std::vector Suffix(TheList.begin()+Mid, TheList.end()); @@ -97,6 +105,11 @@ struct ListReducer { Changed = false; std::vector TrimmedList; for (unsigned i = 1; i < TheList.size()-1; ++i) { // Check interior elts + if (BugpointIsInterrupted) { + std::cerr << "\n\n*** Reduction Interrupted, cleaning up...\n\n"; + return true; + } + std::vector TestList(TheList); TestList.erase(TestList.begin()+i); -- cgit v1.1