aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-reduce/llvm-reduce.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2022-10-24 11:05:06 -0700
committerMatt Arsenault <arsenm2@gmail.com>2022-10-28 16:39:09 -0700
commitf041204ec896a24d19f44b9095660ab8559ebbc7 (patch)
tree85902e05db0598dc40f9da6dd922c7c0ed5a4508 /llvm/tools/llvm-reduce/llvm-reduce.cpp
parent7d568cdc9d68ec295f1e141c8bcad344873f51cd (diff)
downloadllvm-f041204ec896a24d19f44b9095660ab8559ebbc7.zip
llvm-f041204ec896a24d19f44b9095660ab8559ebbc7.tar.gz
llvm-f041204ec896a24d19f44b9095660ab8559ebbc7.tar.bz2
llvm-reduce: Stop checking workitem is interesting before each pass
Each delta pass run should have guaranteed the output is still interesting, so it should be pointless to recheck this each iteration. I have many issues that take multiple minutes to reproduce, so this ends up being a huge waste of time. Also, remove broken line counting. This never worked, since getLines was failing to open the temporary file which was just deleted.
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);