BUGPOINT(1)

πŸ’… BUGPOINT(1) β€” the LLVM bugpoint girlie is here to help

okay so real quick before we get into it: this is the manual page for bugpoint, and it lives in the LLVM manual, bestie. buckle up πŸŽ€


✨ NAME ✨

bugpoint β€” the automatic test case reduction tool. yeah. it shrinks your giant messy test cases down to tiny iconic ones. no cap 🫢


🌸 SYNOPSIS 🌸

bugpoint [options] [input LLVM ll/bc files] [LLVM passes] --args program
arguments

that's the whole vibe. options, then your LLVM .ll/.bc files, then some passes, then --args and the actual program args. slay πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so bugpoint narrows down where the problem actually is in LLVM tools and passes. like, it finds the culprit. it's giving detective main character energy πŸ”₯

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 is to reduce large test cases into small, useful ones. literally so helpful. for more info on the design and inner workings of bugpoint, plus advice for using it, see 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. highkey useful if you're debugging programs that depend on non-LLVM libraries (like the X or curses libraries) 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 β€” passes all arguments specified after --args to the test program whenever it runs. ngl, if any of the program args start with a -, you should use:
bugpoint [bugpoint args] --args -- [program args]

the -- right after the --args option tells bugpoint to consider any options starting with - to be part of the --args option, not as options to bugpoint itself. periodt. πŸ’œ

  • --tool-args tool args β€” passes all arguments specified after --tool-args to the LLVM tool under test (llc, lli, etc.) whenever it runs. you should use this option like:
bugpoint [bugpoint args] --tool-args -- [tool args]

the -- right after the --tool-args option tells bugpoint to consider any options starting with - to be part of the --tool-args option, not as options to bugpoint itself. (see --args, above.) πŸŽ€

  • --safe-tool-args tool args β€” passes all arguments specified after --safe-tool-args to the "safe" execution tool. πŸ’…
  • --gcc-tool-args gcc tool args β€” passes all arguments specified after --gcc-tool-args to the invocation of gcc. 🌸
  • --opt-args opt args β€” passes all arguments specified after --opt-args to the invocation of opt. πŸ¦‹
  • --disable-{dce,simplifycfg} β€” don't run the specified passes to clean up and reduce the size of the test program. by default, bugpoint uses these passes internally when attempting to reduce test programs. heads up though: if you're trying to find a bug in one of these passes, bugpoint may crash 😭 πŸ’€
  • --enable-valgrind β€” uses valgrind to find faults in the optimization phase. this lets bugpoint find otherwise asymptomatic problems caused by memory mis-management. lowkey iconic πŸ”₯
  • -find-bugs β€” continually randomizes the specified passes and runs them on the test program until a bug is found or the user kills bugpoint. it just keeps going. main character energy fr fr πŸ‘‘
  • -help β€” prints a summary of command line options. bestie's little lifeline 🫢
  • --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 will add new command line options to enable various optimizations. to see the new complete list of optimizations, use the -help and --load options together; for example:
bugpoint --load myNewPass.so -help

so cute, so powerful ✨

  • --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. 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 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. πŸ™ˆ
  • --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). yeah, it's backwards-feeling, but that's the deal 😭

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. literally so clever 🧠✨

  • --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. useful to make 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. simple as that, bestie πŸ’…


πŸŽ€ SEE ALSO πŸŽ€


πŸ‘‘ Author

maintained by the LLVM Team (https://llvm.org/). they're the blueprint, honestly.

2003-2026, LLVM Project


and that's the whole page, bestie 🫢 this was BUGPOINT(1) from the LLVM manual, dated 2026-05-15, version 21 β€” go reduce something iconic πŸ’…βœ¨

πŸ“¦ where this page comes from