aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-reduce/llvm-reduce.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-reduce/llvm-reduce.cpp')
-rw-r--r--llvm/tools/llvm-reduce/llvm-reduce.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/tools/llvm-reduce/llvm-reduce.cpp b/llvm/tools/llvm-reduce/llvm-reduce.cpp
index 13c6edc..5cadaa7 100644
--- a/llvm/tools/llvm-reduce/llvm-reduce.cpp
+++ b/llvm/tools/llvm-reduce/llvm-reduce.cpp
@@ -92,6 +92,8 @@ static cl::opt<int>
static codegen::RegisterCodeGenFlags CGF;
+bool isReduced(ReducerWorkItem &M, TestRunner &Test);
+
void writeOutput(ReducerWorkItem &M, StringRef Message) {
if (ReplaceInput) // In-place
OutputFilename = InputFilename.c_str();
@@ -182,6 +184,15 @@ int main(int Argc, char **Argv) {
TestRunner Tester(TestFilename, TestArguments, std::move(OriginalProgram),
std::move(TM), Argv[0]);
+ // This parses and writes out the testcase into a temporary file copy for the
+ // test, rather than evaluating the source IR directly. This is for the
+ // convenience of lit tests; the stripped out comments may have broken the
+ // interestingness checks.
+ if (!isReduced(Tester.getProgram(), Tester)) {
+ errs() << "\nInput isn't interesting! Verify interesting-ness test\n";
+ return 1;
+ }
+
// Try to reduce code
runDeltaPasses(Tester, MaxPassIterations);