[llvm] [llvm][docs] Add example use of `llvm-reduce`. (PR #73237)
Francesco Petrogalli via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 29 04:01:07 PST 2023
================
@@ -105,4 +105,33 @@ EXIT STATUS
:program:`llvm-reduce` returns 0 under normal operation. It returns a non-zero
exit code if there were any errors.
+EXAMPLE
+-------
+:program:`llvm-reduce` can be used to simplify a test that causes a
+compiler crash.
+
+For example, let's assume that `opt` is crashing on the IR file
+`test.ll` with error message `Assertion failed at line 1234 of
+WhateverFile.cpp`, when running at `-O2`.
+
+The test case of `test.ll` can be reduced by invoking the following
+command:
+
+.. code-block:: bash
+
+ $(LLVM_BUILD_FOLDER)/bin/llvm-reduce --test=script.sh <path to>/test.ll
+
+The shell script passed to the option `test` consists of the
+following:
+
+.. code-block:: bash
+
+ $(LLVM_BUILD_FOLDER)/bin/opt -O2 -S $1 -o /dev/null \
----------------
fpetrogalli wrote:
Done.
https://github.com/llvm/llvm-project/pull/73237
More information about the llvm-commits
mailing list