BUGPOINT(1)
π BUGPOINT(1) π
okay bestie, so this is bugpoint from the LLVM fam β the automatic test case reduction tool π and honestly? it's giving legendary. let's get into it.
β¨ NAME β¨
bugpoint β the automatic test case reduction tool. that's her whole job. she takes your mess and makes it smol π
πΈ SYNOPSIS πΈ
bugpoint [options] [input LLVM ll/bc files] [LLVM passes] --args program
arguments
π¦ DESCRIPTION π¦
so like, bugpoint narrows down the source of problems in LLVM tools and passes. it's the friend who helps you figure out which thing is actually broken instead of you just screaming at your terminal π
she can debug three (3) types of failures:
- optimizer crashes
- miscompilations by optimizers
- bad native code generation (which lowkey includes problems in the static and JIT compilers, if we're being thorough π )
her whole goal? reduce large test cases into small, useful ones. big messy testcase in, smol iconic testcase out π«Ά
if you want the deep lore on the design and inner workings of bugpoint, plus some advice for using her, go read LLVM bugpoint tool: design and usage in the LLVM distribution. iykyk π
π OPTIONS π
--additional-solibrary β loads the dynamic shared object library into the test program every time it runs. super useful when you're debugging programs that depend on non-LLVM libraries (like the X or curses libraries) to actually run π--append-exit-code={true,false}β appends the test program's exit code to the output file, so that a change in exit code counts as a test failure. defaults tofalse. noted β¨--argsprogram args β passes everything after--argsto the test program whenever it runs. important caveat bestie: if any of the program args start with a-, you gotta do this:
bugpoint [bugpoint args] --args -- [program args]
that -- right after the --args option tells bugpoint to treat anything starting with - as part of the --args option instead of as options to bugpoint herself. she's easily confused, be nice to her π
--tool-argstool args β passes everything after--tool-argsto the LLVM tool under test (llc,lli, etc.) whenever it runs. use it like this:
bugpoint [bugpoint args] --tool-args -- [tool args]
same deal as before: the -- right after --tool-args tells bugpoint that any options starting with - belong to --tool-args, not to bugpoint itself. (see --args above, bestie π)
--safe-tool-argstool args β passes everything after--safe-tool-argsto the "safe" execution tool. yes ma'am π«‘--gcc-tool-argsgcc tool args β passes everything after--gcc-tool-argsto the invocation ofgcc. iconic compiler behavior π--opt-argsopt args β passes everything after--opt-argsto the invocation ofopt. slay π₯--disable-{dce,simplifycfg}β do not run the specified passes to clean up and reduce the size of the test program. by defaultbugpointuses these passes internally when trying to reduce test programs. β οΈ but heads up: if you're trying to find a bug in one of these passes,bugpointmay crash. you've been warned, bestie π--enable-valgrindβ usesvalgrindto find faults in the optimization phase. this letsbugpointfind otherwise asymptomatic problems caused by memory mis-management. very detective of her π-find-bugsβ continually randomizes the specified passes and runs them on the test program until a bug is found or the user killsbugpoint. truly main character energy β she'll go forever until you Ctrl+C her π-helpβ prints a summary of command line options. the classic π--inputfilename β opens filename and redirects the standard input of the test program to come from that file whenever it runs. feeding time π--loadplugin β loads the dynamic object plugin intobugpointherself. this object should register new optimization passes. once loaded, the object adds new command line options to enable various optimizations. to see the new complete list of optimizations, use-helpand--loadtogether, like:
bugpoint --load myNewPass.so -help
--mlimitmegabytes β specifies an upper limit on memory usage of the optimization and codegen. set it to zero to disable the limit. no cap π§’--outputfilename β whenever the test program produces output on its standard output stream, it should match the contents of filename (aka the "reference output"). if you don't use this option,bugpointwill attempt to generate a reference output by compiling the program with the "safe" backend and running it. she's resourceful like that π--run-{int,jit,llc,custom}β whenever the test program is compiled,bugpointshould generate code for it using the specified code generator. these options let you choose the interpreter, the JIT compiler, the static native code compiler, or a custom command (see--exec-command) respectively. pick your fighter β--safe-{llc,custom}β when debugging a code generator,bugpointshould use the specified code generator as the "safe" code generator. this is a known-good code generator used to generate the "reference output" if it hasn't been provided, and to compile portions of the program that are excluded from the testcase. these options let you choose the static native code compiler or a custom command (see--exec-command) respectively. π¨ important: the interpreter and the JIT backends cannot currently be used as the "safe" backends. periodt.--exec-commandcommand β defines the command to use with the--run-customand--safe-customoptions to execute the bitcode testcase. this can be useful for cross-compilation π--compile-commandcommand β defines the command to use with the--compile-customoption to compile the bitcode testcase. the command should exit with a failure exit code if the file is "interesting" and should exit with a success exit code (i.e.0) otherwise (this is the same as if it crashed on "interesting" inputs). yes, the logic is backwards, no, we don't make the rules π
this can be useful for testing compiler output without running any link or execute stages. to generate a reduced unit test, you may add CHECK directives to the testcase and pass the name of an executable compile-command script in this form:
#!/bin/sh
llc "$@"
not FileCheck [bugpoint input file].ll < bugpoint-test-program.s
this script will "fail" as long as FileCheck passes. so the result will be the minimum bitcode that passes FileCheck. genius honestly π
--safe-pathpath β defines the path to the command to execute with the--safe-{int,jit,llc,custom}option. know your path bestie π£οΈ--verbose-errors={true,false}β the default behavior ofbugpointis to print<crash>when it finds a reduced test that crashes compilation. this flag prints the output of the crashing program to stderr instead. useful for making sure it's the same error being tracked down and not a different error that happens to crash the compiler too. defaults tofalse. the more you know π‘
π EXIT STATUS π
if bugpoint succeeds in finding a problem, she exits with 0 π otherwise, if an error occurs, she exits with a non-zero value. simple as that π
π§ SEE ALSO π§
opt(1) β go say hi to her sister β¨
πΊ AUTHOR πΊ
maintained by the LLVM Team (https://llvm.org/) π«Ά
π COPYRIGHT π
2003-2025, LLVM Project
okay that's the whole page, bestie! and just so you know this was page 19, dated 2025-01-17, and it's from BUGPOINT(1) β so like, cite her properly if you're gonna gossip about her at the group chat π
β¨ bye ily π
π¦ where this page comes from
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms