BUGPOINT(1)
π BUGPOINT(1) π
okay bestie, gather round, because this one is the glow-up tool for your broken LLVM code and i'm obsessed π
it lives in the LLVM manual, section 1, and it's literally called bugpoint π¦
β¨ NAME β¨
bugpoint β the automatic test case reduction tool π (yes queen, it shrinks your cursed giant testcase down to something smol and cute)
β¨ SYNOPSIS β¨
bugpoint [options] [input LLVM ll/bc files] [LLVM passes] --args program arguments
β¨ DESCRIPTION β¨
so bugpoint narrows down the source of problems in LLVM tools and passes πΈ it's your little detective bestie.
it can debug three types of failures:
- optimizer crashes π
- miscompilations by optimizers π
- bad native code generation β including problems in the static and JIT compilers π
and its whole goal? take a big ol' messy test case and reduce it to a small, useful one β¨ iconic behaviour honestly.
if you want the deep lore on the design and inner workings of bugpoint, plus advice on using it, go read LLVM bugpoint tool: design and usage in the LLVM distribution π iykyk.
β¨ OPTIONS β¨
--additional-solibrary β load this dynamic shared object library into the test program whenever it runs π«Ά super useful when you're debugging programs that depend on non-LLVM libraries (like the X or curses libraries) just to 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 β pass everything you write after--argsto the test program whenever it runs π and listen, if any of the program args start with a-, you gotta do it like this:
bugpoint [bugpoint args] --args -- [program args]
that -- right after --args tells bugpoint "bestie, anything starting with - after this is part of the --args option, NOT an option for bugpoint itself" π
--tool-argstool args β pass everything after--tool-argsto the LLVM tool under test (llc,lli, etc.) whenever it runs. use it like:
bugpoint [bugpoint args] --tool-args -- [tool args]
that -- right after --tool-args tells bugpoint to treat anything starting with - as part of the --tool-args option, not as an option to bugpoint itself. (see --args, above π)
--safe-tool-argstool args β pass everything after--safe-tool-argsto the"safe"execution tool π--gcc-tool-argsgcc tool args β pass everything after--gcc-tool-argsto the invocation ofgccπ§--opt-argsopt args β pass everything after--opt-argsto the invocation ofoptβ--disable-{dce,simplifycfg}β do not run the specified passes to clean up and reduce the size of the test program π« by default bugpoint uses 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, bugpoint may crash π (you did this to yourself bestie).--enable-valgrindβ usevalgrindto find faults in the optimization phase π this lets bugpoint find otherwise asymptomatic problems caused by memory mis-management π sneakyyyy.-find-bugsβ continually randomize the specified passes and run them on the test program until a bug is found or the user kills bugpoint ππ° pure chaos mode, we love her.-helpβ print a summary of command line options π--inputfilename β open filename and redirect the standard input of the test program, whenever it runs, to come from that file πΈ--loadplugin β load the dynamic object plugin into bugpoint itself π¦ this object should register new optimization passes. once loaded, the object will add 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.--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, bugpoint will attempt 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, bugpoint should 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 π--safe-{llc,custom}β when debugging a code generator, bugpoint should 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. the interpreter and the JIT backends cannot currently be used as the"safe"backends π«--exec-commandcommand β this option defines the command to use with the--run-customand--safe-customoptions to execute the bitcode testcase πΈ can be useful for cross-compilation β¨--compile-commandcommand β this option 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 π
--safe-pathpath β this option defines the path to the command to execute with the--safe-{int,jit,llc,custom}option π--verbose-errors={true,false}β the default behavior of bugpoint is to print"<crash>"when it finds a reduced test that crashes compilation π this flag prints the output of the crashing program tostderrπ super useful for making sure it's the same error being tracked down and not a different error that happens to crash the compiler as well. defaults tofalse.
β¨ EXIT STATUS β¨
if bugpoint succeeds in finding a problem, it will exit with 0 π otherwise, if an error occurs, it will exit with a non-zero value π
β¨ SEE ALSO β¨
opt(1) π¦
β¨ AUTHOR β¨
maintained by the LLVM Team (https://llvm.org/) π
β¨ COPYRIGHT β¨
2003-2024, LLVM Project π
okay that's the whole thing bestie, you're SO ready to go reduce some testcases now, go slay π β¨
this was BUGPOINT(1) from the LLVM manual, dated 2024-07-18 β mwah, periodt π«Ά
π¦ where this page comes from
- fedora 43: llvm12 12.0.1-12.fc41 Β· NCSA
- fedora 43: llvm12 12.0.1-12.fc41 Β· NCSA
- fedora 44: llvm12 12.0.1-12.fc41 Β· NCSA
- fedora 44: llvm12 12.0.1-12.fc41 Β· NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms