aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bugpoint/ListReducer.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-02 02:16:17 +0000
committerChris Lattner <sabre@nondot.org>2005-08-02 02:16:17 +0000
commitf9aaae06cd2109082cda2b09ef3f23e0e1cff47b (patch)
tree2464ee9f4149dbeba1695647ba8e4c24dd23ae9b /tools/bugpoint/ListReducer.h
parentfa8c292ebd893b3effef4ead9c88d261c628c340 (diff)
downloadexternal_llvm-f9aaae06cd2109082cda2b09ef3f23e0e1cff47b.zip
external_llvm-f9aaae06cd2109082cda2b09ef3f23e0e1cff47b.tar.gz
external_llvm-f9aaae06cd2109082cda2b09ef3f23e0e1cff47b.tar.bz2
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
Diffstat (limited to 'tools/bugpoint/ListReducer.h')
-rw-r--r--tools/bugpoint/ListReducer.h13
1 files changed, 13 insertions, 0 deletions
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 <iostream>
namespace llvm {
+
+ extern bool BugpointIsInterrupted;
template<typename ElTy>
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<ElTy> Prefix(TheList.begin(), TheList.begin()+Mid);
std::vector<ElTy> Suffix(TheList.begin()+Mid, TheList.end());
@@ -97,6 +105,11 @@ struct ListReducer {
Changed = false;
std::vector<ElTy> 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<ElTy> TestList(TheList);
TestList.erase(TestList.begin()+i);