From: Chris Lattner Date: Thu, 24 Apr 2003 19:32:42 +0000 (+0000) Subject: Allow bugpoint to try new an different methods for pruning down lists X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a148ccb15888091c42fa986e612a8ae1e448282f;p=oota-llvm.git Allow bugpoint to try new an different methods for pruning down lists git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5905 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index d382c06c834..4960b8205de 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/tools/bugpoint/Miscompilation.cpp @@ -72,6 +72,30 @@ struct ListReducer { break; } } + + // Okay, we trimmed as much off the top and the bottom of the list as we + // could. If there is more two elements in the list, try deleting interior + // elements and testing that. + // + if (TheList.size() > 2) { + bool Changed = true; + std::vector EmptyList; + while (Changed) { + Changed = false; + std::vector TrimmedList; + for (unsigned i = 1; i < TheList.size()-1; ++i) { // Check interior elts + std::vector TestList(TheList); + TestList.erase(TestList.begin()+i); + + if (doTest(EmptyList, TestList) == KeepSuffix) { + // We can trim down the list! + TheList.swap(TestList); + --i; // Don't skip an element of the list + Changed = true; + } + } + } + } } }; @@ -187,7 +211,7 @@ public: const std::vector &Kept) { if (TestFuncs(Kept, false)) return KeepSuffix; - if (TestFuncs(Prefix, false)) + if (!Prefix.empty() && TestFuncs(Prefix, false)) return KeepPrefix; return NoFailure; }