BUGPOINT(1)
π BUGPOINT(1) β the LLVM automatic test case reduction tool π
okay bestie, welcome to bugpoint, straight out of the LLVM manual. this little icon does one thing and does it beautifully: it takes your giant cursed test case and shrinks it down until only the juicy problematic part is left. no cap. π
β¨ NAME β¨
bugpoint β the automatic test case reduction tool. it's giving "personal trainer for your broken code." π
πΈ 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. that's the whole vibe. π«Ά
it can debug three types of failures, and yes we're listing them:
- optimizer crashes π
- miscompilations by optimizers
- <orange>bad native code generation</orange> (including problems in the static and JIT compilers)
its whole goal? take a big chonky test case and reduce it to something small and useful. main character energy fr fr. β¨
for more info on the design and inner workings of bugpoint, plus advice for using it, go read LLVM bugpoint tool: design and usage in the LLVM distribution. iykyk. π
π OPTIONS π
--additional-solibrary β loads that 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 even 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. β--argsprogram args β passes everything you type after--argsto the test program whenever it runs. heads up though: if any of the program args start with a-, you gotta do it like this:
bugpoint [bugpoint args] --args -- [program args]
that -- right after the --args option is the magic β it tells bugpoint to treat anything starting with - as part of the --args option, not as an option for bugpoint itself. πͺ
--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]
and again, that -- right after --tool-args tells bugpoint to consider any options starting with - as part of the --tool-args option, not as options to bugpoint itself. (see --args, above.) π
--safe-tool-argstool args β passes everything after--safe-tool-argsto the "safe" execution tool. π--gcc-tool-argsgcc tool args β passes everything after--gcc-tool-argsto the invocation ofgcc. π§--opt-argsopt args β passes everything after--opt-argsto the invocation ofopt. β¨--disable-{dce,simplifycfg}β don't run the specified passes to clean up and shrink the test program. by default,bugpointuses these passes internally when it's trying to reduce test programs. β οΈ so likeβ¦ 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 letsbugpointcatch otherwise asymptomatic problems caused by memory mis-management. π₯-find-bugsβ continually randomizes the specified passes and runs them on the test program until a bug is found or you killbugpoint. chaotic. iconic. endless. π-helpβ prints a summary of command line options. classic. π--inputfilename β opens filename and redirects the standard input of the test program, whenever it runs, to come from that file. πΈ--loadplugin β loads the dynamic object plugin intobugpointitself. 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 β sets an upper limit on memory usage of the optimization and codegen. set it to zero to disable the limit. π--outputfilename β whenever the test program produces output on its standard output stream, it should match the contents of filename (the "reference output"). if you don't use this option,bugpointwill try to generate a reference output by compiling the program with the "safe" backend and running it. π¦--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 pick 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 as they get excluded from the testcase. these options let you choose the static native code compiler, or a custom command, (see--exec-command) respectively. π¨ the interpreter and the JIT backends cannot currently be used as the "safe" backends. noted.--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). π
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. slay. β¨
--safe-pathpath β defines the path to the command to execute with the--safe-{int,jit,llc,custom}option. π--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. π
π EXIT STATUS π
if bugpoint succeeds in finding a problem, it exits with 0. π
otherwise, if an error occurs, it exits with a non-zero value. π
π SEE ALSO π
π AUTHOR π
maintained by the LLVM Team (https://llvm.org/). π«Ά
π COPYRIGHT π
2003-2024, LLVM Project
okay that's the whole page bestie!! π and for the cute lil sign-off: this was LLVM's bugpoint(1) page, revision 11, dated 2024-07-18 β go forth and reduce your test cases, you absolute legend. πβ¨π¦
π¦ where this page comes from
- fedora 43: llvm11 11.1.0-14.fc41 Β· NCSA
- fedora 43: llvm11 11.1.0-14.fc41 Β· NCSA
- fedora 44: llvm11 11.1.0-14.fc41 Β· NCSA
- fedora 44: llvm11 11.1.0-14.fc41 Β· NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms