145 lines · plain
1llvm-reduce - LLVM automatic testcase reducer.2==============================================3 4.. program:: llvm-reduce5 6SYNOPSIS7--------8 9:program:`llvm-reduce` [*options*] [*input...*]10 11DESCRIPTION12-----------13 14The :program:`llvm-reduce` tool project that can be used for reducing the size of LLVM test cases.15It works by removing redundant or unnecessary code from LLVM test cases while still preserving16their ability to detect bugs.17 18If ``input`` is "``-``", :program:`llvm-reduce` reads from standard19input. Otherwise, it will read from the specified ``filenames``.20 21LLVM-Reduce is a useful tool for reducing the size and22complexity of LLVM test cases, making it easier to identify and debug issues in23the LLVM compiler infrastructure.24 25GENERIC OPTIONS26---------------27 28 29.. option:: --help30 31 Display available options (--help-hidden for more).32 33.. option:: --abort-on-invalid-reduction34 35 Abort if any reduction results in invalid IR36 37.. option::--delta-passes=<string>38 39 Delta passes to run, separated by commas. By default, run all delta passes.40 41 42.. option:: --in-place43 44 WARNING: This option will replace your input file with the reduced version!45 46.. option:: --ir-passes=<string>47 48 A textual description of the pass pipeline, same as what's passed to `opt -passes`.49 50.. option:: -j <uint>51 52 Maximum number of threads to use to process chunks. Set to 1 to disable parallelism.53 54.. option:: --max-pass-iterations=<int>55 56 Maximum number of times to run the full set of delta passes (default=5).57 58.. option:: --mtriple=<string>59 60 Set the target triple.61 62.. option:: --preserve-debug-environment63 64 Don't disable features used for crash debugging (crash reports, llvm-symbolizer and core dumps)65 66.. option:: --print-delta-passes67 68 Print list of delta passes, passable to --delta-passes as a comma separated liste.69 70.. option:: --skip-delta-passes=<string>71 72 Delta passes to not run, separated by commas. By default, run all delta passes.73 74.. option::--skip-verify-interesting-after-counting-chunks75 76 Do not validate testcase is interesting after counting chunks. This77 will save time by avoiding extra executions of the interestingness78 test, but a warning will no longer be printed on flaky reproducers.79 80.. option:: --starting-granularity-level=<uint>81 82 Number of times to divide chunks prior to first test.83 84 Note : Granularity refers to the level of detail at which the reduction process operates.85 A lower granularity means that the reduction process operates at a more coarse-grained level,86 while a higher granularity means that it operates at a more fine-grained level.87 88.. option:: --test=<string>89 90 Name of the interesting-ness test to be run.91 92.. option:: --test-arg=<string>93 94 Arguments passed onto the interesting-ness test.95 96.. option:: --verbose97 98 Print extra debugging information.99 100.. option:: --write-tmp-files-as-bitcode101 102 Always write temporary files as bitcode instead of textual IR.103 104.. option:: -x={ir|mir}105 106 Input language as ir or mir.107 108EXIT STATUS109------------110 111:program:`llvm-reduce` returns 0 under normal operation. It returns a112non-zero exit code if there were any errors. Returns 2 if the113interestingness test reported the initial input was not interesting.114 115EXAMPLE116-------117 118:program:`llvm-reduce` can be used to simplify a test that causes a119compiler crash.120 121For example, let's assume that `opt` is crashing on the IR file122`test.ll` with error message `Assertion failed at line 1234 of123WhateverFile.cpp`, when running at `-O2`.124 125The test case of `test.ll` can be reduced by invoking the following126command:127 128.. code-block:: bash129 130 $(LLVM_BUILD_FOLDER)/bin/llvm-reduce --test=script.sh <path to>/test.ll131 132The shell script passed to the option `test` consists of the133following:134 135.. code-block:: bash136 137 $(LLVM_BUILD_FOLDER)/bin/opt -O2 -disable-output $1 \138 |& grep "Assertion failed at line 1234 of WhateverFile.cpp"139 140(In this script, `grep` exits with 0 if it finds the string and that141becomes the whole script's status.)142 143This example can be generalized to other tools that process IR files,144for example `llc`.145