BUGPOINT(1)

πŸŽ€ BUGPOINT(1) πŸŽ€

okay bestie, this is bugpoint from the LLVM manual, section 1, and she is the automatic test case reduction tool. strap in πŸ’…


✨ NAME ✨

bugpoint β€” the automatic test case reduction tool, aka your new bestie who takes a giant cursed test case and shrinks it down until the actual bug is standing there like πŸ‘οΈπŸ‘„πŸ‘οΈ

✨ 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. literally what she was born to do πŸ’–

she can debug three types of failures, and here they are, no cap:

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

her whole thing is reducing large test cases to small, useful ones β€” like, she's not gonna hand you a 40,000-line file when five lines do the job ✨

for more info on the design and inner workings of bugpoint, plus advice on actually using her, peep "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. highkey useful if you're debugging programs that depend on non-LLVM libraries (think 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, periodt ✨
  • --args program args β€” passes everything you put after --args to the test program whenever it runs. ngl, if any of the program args start with a -, you need to do this:
bugpoint [bugpoint args] --args -- [program args]

the -- right after the --args option is the girlboss move here β€” it tells bugpoint to treat any options starting with - as part of --args, not as options to 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]

again, the -- right after --tool-args tells bugpoint that anything starting with - belongs to --tool-args and not to her. (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 reduce the size of the test program. by default bugpoint uses these passes internally when she's reducing 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 πŸ‘‘
  • -find-bugs β€” continually randomizes the specified passes and runs them on the test program until a bug is found or you kill bugpoint πŸ’€
  • -help β€” prints a summary of command line options πŸ™ˆ
  • --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 herself. this 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

iykyk 🧚

  • --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 πŸ’œ
  • --safe-{llc,custom} β€” when debugging a code generator, bugpoint should use the specified code generator as the "safe" one. 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 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. lowkey 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 ✨ iconic behaviour honestly

  • --safe-path path β€” defines the path to the command to execute with the --safe-{int,jit,llc,custom} option πŸŽ€
  • --verbose-errors={true,false} β€” default behaviour 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. super useful for making sure it's the same error you're tracking 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, she exits with 0 β€” slay πŸŽ‰ otherwise, if an error occurs, she exits with a non-zero value 😭

✨ SEE ALSO ✨

opt(1) <opt.html> 🫢

πŸ’– Author πŸ’–

maintained by the LLVM Team (https://llvm.org/) πŸ‘‘

2003-2026, LLVM Project 🌸


and that's the whole page bestie πŸŽ€ this was LLVM version 15, dated 2026-09-09 β€” go reduce something iconic πŸ’…βœ¨

πŸ“¦ where this page comes from