BUGPOINT(1)

✨ BUGPOINT ✨

okay bestie, listen up — this is the page for bugpoint, and it lives in the LLVM manual family 💅


🌸 NAME 🌸

bugpoint — the automatic test case reduction tool. she shrinks your mess down to something small and useful. no cap.


🦋 SYNOPSIS 🦋

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

💖 DESCRIPTION 💖

so bugpoint narrows down where problems are hiding in LLVM tools and passes. it's the friend who untangles the whole group chat drama and tells you exactly which message started it 🙈

she can debug three types of failures:

  • optimizer crashes
  • miscompilations by optimizers
  • bad native code generation (that includes problems in the static and JIT compilers)

her whole goal? take a giant test case and reduce it to a small, useful one. periodt.

if you wanna know more about the design and inner workings of bugpoint, plus advice on using her, go read LLVM bugpoint tool: design and usage in the LLVM distribution 📚


✨ OPTIONS ✨

  • –additional-so library — Loads the dynamic shared object library into the test program every time it runs. this is the move when you're debugging programs that depend on non-LLVM libraries to run — think the X or curses libraries 👑
  • –append-exit-code={true,false} — Appends the test program's exit code to the output file, so that if the exit code changes, that counts as a test failure. defaults to false.
  • –args program args — Passes all the arguments you write after –args to the test program every time 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 telling bugpoint "hey, anything starting with - from here on is part of the –args option, not an option for you." iconic behavior tbh.

  • –tool-args tool args — Passes all arguments after –tool-args to the LLVM tool under test (llc, lli, etc.) every time 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 for bugpoint itself. (see –args, above ⬆️)

  • –safe-tool-args tool args — Passes all arguments after –safe-tool-args to the "safe" execution tool.
  • –gcc-tool-args gcc tool args — Passes all arguments after –gcc-tool-args to the invocation of gcc.
  • –opt-args opt args — Passes all arguments 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 she's trying to reduce test programs. so like… 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 catch otherwise asymptomatic problems caused by memory mis-management. lowkey a glow-up for your debugging.
  • -find-bugs — Continually randomizes the specified passes and runs them on the test program until a bug is found or the user kills bugpoint. main character energy: she just keeps going until you stop 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, every time it runs.
  • –load plugin — Loads the dynamic object plugin into bugpoint herself. that object should register new optimization passes. once it's 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 entirely.
  • –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.
  • –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 the portions of the program that get excluded from the testcase. these options let you pick the static native code compiler, or a custom command (see –exec-command) respectively. and bestie, heads up: 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).

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 — 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 she finds a reduced test that crashes compilation. this flag prints the output of the crashing program to stderr instead. it's useful for making sure it's the same error being tracked down and not a different error that just happens to crash the compiler too. defaults to false.

👑 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)


🌟 AUTHOR 🌟

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


2003-2025, LLVM Project


and that's the whole page, bestie 🦋 this was the bugpoint(1) page from LLVM, dated 2025-05-22 — go reduce some test cases, you got this 💖✨

📦 where this page comes from