BUGPOINT(1)

πŸ“¦
version 11.1.0 Β· 2 versions
, in fedora 43, fedora 44

πŸ’– 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-so library β€” 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 to false. ⭐
  • --args program args β€” passes everything you type after --args to 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-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]

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-args tool args β€” passes everything after --safe-tool-args to the "safe" execution tool. 🌈
  • --gcc-tool-args gcc tool args β€” passes everything after --gcc-tool-args to the invocation of gcc. 🧚
  • --opt-args opt args β€” passes everything after --opt-args to the invocation of opt. ✨
  • --disable-{dce,simplifycfg} β€” don't run the specified passes to clean up and shrink 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've been warned bestie.
  • --enable-valgrind β€” uses valgrind to find faults in the optimization phase. this lets bugpoint catch 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 kill bugpoint. chaotic. iconic. endless. πŸ’€
  • -help β€” prints a summary of command line options. classic. πŸŽ€
  • --input filename β€” opens filename and redirects the standard input of the test program, whenever it runs, to come from that file. 🌸
  • --load plugin β€” loads the dynamic object plugin into bugpoint itself. 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 β€” sets 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 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, bugpoint should 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, 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 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-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). πŸ’…

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-path path β€” 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 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. πŸ”

πŸ’€ 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 🌟

opt(1)


πŸ‘‘ AUTHOR πŸ‘‘

maintained by the LLVM Team (https://llvm.org/). 🫢


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