BUGPOINT(1)

πŸ“¦
version 12.0.1 Β· 4 versions
, in fedora 43, fedora 44

πŸ’– 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:

  1. optimizer crashes 😭
  2. miscompilations by optimizers πŸ’€
  3. 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-so library β€” 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 to false.
  • --args program args β€” pass everything you write after --args to 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-args tool args β€” pass everything after --tool-args to 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-args tool args β€” pass everything after --safe-tool-args to the "safe" execution tool 🌈
  • --gcc-tool-args gcc tool args β€” pass everything after --gcc-tool-args to the invocation of gcc 🧚
  • --opt-args opt args β€” pass everything after --opt-args to the invocation of opt ⭐
  • --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 β€” use valgrind to 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 πŸ“‹
  • --input filename β€” open filename and redirect the standard input of the test program, whenever it runs, to come from that file 🌸
  • --load plugin β€” 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 -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.
  • --output filename β€” 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-command command β€” this option defines the command to use with the --run-custom and --safe-custom options to execute the bitcode testcase 🌸 can be useful for cross-compilation ✨
  • --compile-command command β€” this option 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 πŸ’€).

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-path path β€” 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 to stderr 😭 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 to false.

✨ 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/) πŸ’–


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