From 3870f61b08094cfb2f1cade7617180476157c4f5 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Wed, 2 Apr 2025 10:04:35 +0700 Subject: [PATCH] llvm-reduce: Change exit code for uninteresting inputs This makes it easier to reduce llvm-reduce with llvm-reduce to filter cases where the input reduced too much. Not sure if it's possible to test the exit code in lit. --- llvm/docs/CommandGuide/llvm-reduce.rst | 5 +++-- llvm/tools/llvm-reduce/llvm-reduce.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/llvm/docs/CommandGuide/llvm-reduce.rst b/llvm/docs/CommandGuide/llvm-reduce.rst index 2670668af6cca..85111e6e29443 100644 --- a/llvm/docs/CommandGuide/llvm-reduce.rst +++ b/llvm/docs/CommandGuide/llvm-reduce.rst @@ -108,8 +108,9 @@ GENERIC OPTIONS EXIT STATUS ------------ -:program:`llvm-reduce` returns 0 under normal operation. It returns a non-zero -exit code if there were any errors. +:program:`llvm-reduce` returns 0 under normal operation. It returns a +non-zero exit code if there were any errors. Returns 2 if the +interestingness test reported the initial input was not interesting. EXAMPLE ------- diff --git a/llvm/tools/llvm-reduce/llvm-reduce.cpp b/llvm/tools/llvm-reduce/llvm-reduce.cpp index 288a384c2ed49..f7492988084ce 100644 --- a/llvm/tools/llvm-reduce/llvm-reduce.cpp +++ b/llvm/tools/llvm-reduce/llvm-reduce.cpp @@ -203,7 +203,7 @@ int main(int Argc, char **Argv) { // interestingness checks. if (!Tester.getProgram().isReduced(Tester)) { errs() << "\nInput isn't interesting! Verify interesting-ness test\n"; - return 1; + return 2; } // Try to reduce code