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:

  1. optimizer crashes
  2. miscompilations by optimizers
  3. 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-so library β€” 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 to false. noted ✨
  • --args program args β€” passes everything after --args to 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-args tool args β€” passes everything after --tool-args to 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-args tool args β€” passes everything after --safe-tool-args to the "safe" execution tool. yes ma'am 🫑
  • --gcc-tool-args gcc tool args β€” passes everything after --gcc-tool-args to the invocation of gcc. iconic compiler behavior πŸ’š
  • --opt-args opt args β€” passes everything after --opt-args to the invocation of opt. slay πŸ”₯
  • --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 trying to reduce test programs. ⚠️ but heads up: if you're trying to find a bug in one of these passes, bugpoint may crash. you've been warned, bestie 😭
  • --enable-valgrind β€” uses valgrind to find faults in the optimization phase. this lets bugpoint find 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 kills bugpoint. truly main character energy β€” she'll go forever until you Ctrl+C her πŸ’€
  • -help β€” prints a summary of command line options. the classic πŸŽ€
  • --input filename β€” opens filename and redirects the standard input of the test program to come from that file whenever it runs. feeding time πŸ“
  • --load plugin β€” loads the dynamic object plugin into bugpoint herself. 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 -help and --load together, like:
bugpoint --load myNewPass.so -help
  • --mlimit megabytes β€” specifies an upper limit on memory usage of the optimization and codegen. set it to zero to disable the limit. no cap 🧒
  • --output filename β€” 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, bugpoint will 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, 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. pick your fighter ⭐
  • --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. 🚨 important: the interpreter and the JIT backends cannot currently be used as the "safe" backends. periodt.
  • --exec-command command β€” defines the command to use with the --run-custom and --safe-custom options to execute the bitcode testcase. this can be useful for cross-compilation 🌈
  • --compile-command command β€” defines the command to use with the --compile-custom option 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-path path β€” 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 of bugpoint is 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 to false. 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/) 🫢


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