LLVM-REDUCE(1)
π LLVM-REDUCE(1) β the LLVM automatic testcase reducer, bestie edition
ok so this is the llvm-reduce page from the LLVM manual set, and honestly? it's a whole vibe. it's the friend who helps you Marie Kondo your cursed test file until only the bug remains. β¨
πΈ NAME πΈ
llvm-reduce β the LLVM automatic testcase reducer, no cap.
π SYNOPSIS π
llvm-reduce [options] [input...]
π¦ DESCRIPTION π¦
So llvm-reduce is this tool in the LLVM project that shrinks your LLVM test cases down to size. the way it works? it just removes redundant or unnecessary code from your LLVM test cases while still keeping the test's ability to detect bugs. slay. it's giving "cut the filler, keep the plot."
If input is -, llvm-reduce reads from standard input. otherwise it reads from the filenames you gave it. simple as that. π
and like, that's genuinely useful: llvm-reduce reduces the size and complexity of LLVM test cases, which makes it way easier to identify and debug issues in the LLVM compiler infrastructure. literally the self-care your testcase needed. π₯
β¨ GENERIC OPTIONS β¨
--helpβ shows you the available options. add--help-hiddenif you want the extra ones too π--abort-on-invalid-reductionβ aborts if any reduction ends up producing invalid IR. like a bouncer for bad transformations π--in-placeβ WARNING: this option will replace your input file with the reduced version! bestie. back it up first, i'm begging π--ir-passes=<string>β a textual description of the pass pipeline, same as what's passed toopt -passes.-j <uint>β max number of threads used to process chunks. set it to1to disable parallelism entirely.--max-pass-iterations=<int>β max number of times to run the full set of delta passes (default=5).--mtriple=<string>β sets the target triple.--preserve-debug-environmentβ don't disable the features used for crash debugging (crash reports,llvm-symbolizerand core dumps). keep the forensics, queen π--print-delta-passesβ prints the list of delta passes, which you can hand to--delta-passesas a comma separated list.--skip-delta-passes=<string>β the delta passes you don't want to run, separated by commas. by default, all delta passes run.--starting-granularity-level=<uint>β number of times to divide chunks before the first test.
Note: granularity refers to the level of detail at which the reduction process operates. a lower granularity means the reduction process operates at a more coarse-grained level, while a higher granularity means it operates at a more fine-grained level. iykyk π§
--test=<string>β name of the interesting-ness test to be run. this is the vibe check of the whole operation honestly.--test-arg=<string>β arguments passed onto the interesting-ness test.--verboseβ prints extra debugging information. main character energy for your terminal π--write-tmp-files-as-bitcodeβ always writes temporary files as bitcode instead of textual IR.-x={ir|mir}β input language, asirormir.
π EXIT STATUS π
llvm-reduce returns 0 under normal operation. it returns a non-zero exit code if there were any errors. and it returns 2 if the interestingness test reported that the initial input was not interesting. awkward but valid π
π EXAMPLE π
llvm-reduce can be used to simplify a test that causes a compiler crash. let's go π«Ά
for example, let's assume that opt is crashing on the IR file test.ll with the 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:
$(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:
$(LLVM_BUILD_FOLDER)/bin/opt -O2 -disable-output $1 \
|& grep "Assertion failed at line 1234 of WhateverFile.cpp"
(in this script, grep exits with 0 if it finds the string and that becomes the whole script's status.) iconic behavior honestly β
this example can be generalized to other tools that process IR files β for example llc. π
π Author π
maintained by the LLVM Team (https://llvm.org/). they ate, fr fr.
πΈ Copyright πΈ
2003-2026, LLVM Project.
ok bye bestie!! this page was page 23, dated 2026-10-20, from the LLVM-REDUCE(1) corner of the LLVM manual β go forth and reduce responsibly, and remember: --in-place will absolutely eat your input file π₯ππ«Ά
π¦ where this page comes from
- arch rolling: llvm 23.1.4-1 Β· Apache-2.0 WITH LLVM-exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms