LLVM-REDUCE(1)
π LLVM-REDUCE(1) β the LLVM automatic testcase reducer, bestie edition
okay so you've stumbled into the LLVM manual pages and this one is genuinely iconic: llvm-reduce is the LLVM automatic testcase reducer β¨
πΈ NAME πΈ
llvm-reduce β LLVM automatic testcase reducer. that's it, that's the vibe π
π¦ SYNOPSIS π¦
llvm-reduce [options] [input...]
π DESCRIPTION π
so llvm-reduce is a tool project that can be used for reducing the size of LLVM test cases π it works by removing redundant or unnecessary code from LLVM test cases while still preserving their ability to detect bugs β like, it's giving "declutter my life but keep the important receipts" energy π
if input is -, llvm-reduce reads from standard input. otherwise, it will read from the specified filenames. super simple, no notes π«Ά
ngl, LLVM-Reduce is a useful tool for reducing the size and complexity of LLVM test cases, making it easier to identify and debug issues in the LLVM compiler infrastructure. literally the main character of your debugging session π
β¨ GENERIC OPTIONS β¨
--helpβ Display available options (--help-hiddenfor more). yes queen, read the docs π--abort-on-invalid-reductionβ Abort if any reduction results in invalid IR. like, if the reduction goes off the rails, we stop, periodt π--in-placeβ WARNING: This option will replace your input file with the reduced version! π¨ bestie please back that file up first, i'm begging π--ir-passes=<string>β a textual description of the pass pipeline, same as what's passed toopt -passes. yep, same thing, no cap π₯-j <uint>β Maximum number of threads to use to process chunks. Set to1to disable parallelism. multitasking but make it configurable π§--max-pass-iterations=<int>β Maximum number of times to run the full set of delta passes (default=5). five rounds, then we're done π--mtriple=<string>β Set the target triple. tell it where it's going π―--preserve-debug-environmentβ Don't disable features used for crash debugging (crash reports,llvm-symbolizerand core dumps). keep the receipts for the crash investigation π--print-delta-passesβ Print list of delta passes, passable to--delta-passesas a comma separated list. window shopping for passes, obsessed ποΈ--skip-delta-passes=<string>β Delta passes to not run, separated by commas. By default, run all delta passes. it's giving "nah, not that one" π--starting-granularity-level=<uint>β Number of times to divide chunks prior to first test.
Note : Granularity refers to the level of detail at which the reduction process operates. A lower granularity means that the reduction process operates at a more coarse-grained level, while a higher granularity means that it operates at a more fine-grained level. like zooming in on a photo β low granularity is the whole pic, high granularity is, like, one eyebrow π
--test=<string>β Name of the interesting-ness test to be run. the vibe check, essentially β--test-arg=<string>β Arguments passed onto the interesting-ness test. extra notes for the vibe check π--verboseβ Print extra debugging information. yes, talk to me, tell me everything π£οΈ--write-tmp-files-as-bitcodeβ Always write temporary files as bitcode instead of textual IR. bitcode era, no exceptions πΎ-x={ir|mir}β Input language asirormir. pick your fighter πΈ
π EXIT STATUS π
llvm-reduce returns 0 under normal operation. it returns a non-zero exit code if there were any errors. slay when it works, sad girl hours when it doesn't π
π EXAMPLE π
llvm-reduce can be used to simplify a test that causes a compiler crash. classic π©Έ
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:
$(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.) iykyk π₯
this example can be generalized to other tools that process IR files, for example llc. the technique is transferable, bestie π
π§ Author π§
maintained by the LLVM Team (https://llvm.org/). shoutout to the maintainers, absolute icons π«Ά
π« Copyright π«
2003-2026, LLVM Project β yeah, they've been at it since before you were born, respectfully π΅β¨
and that's the whole page, bestie! this cutie came from the LLVM pages, page 15, dated 2026-09-09, and it's filed under LLVM-REDUCE(1) β periodt. go reduce something and text me how it goes πππ¦
π¦ where this page comes from
- ubuntu stonking: llvm-18 1:18.1.8-20ubuntu11 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms