OPT(1)

πŸ’… opt(1) β€” the LLVM optimizer, but make it a group chat πŸ’…

okay bestie, welcome to opt, aka the LLVM optimizer, straight out of the LLVM family. this is the manual page for section 1, and yes we are doing this properly. sit down, hydrate, let's go 🫢


✨ NAME ✨

opt β€” the LLVM optimizer. that's the whole vibe. she optimizes. she analyzes. she slays πŸ’…


🌸 SYNOPSIS 🌸

opt [options] [filename]

that's it. that's the whole incantation. options and a filename, iconic behavior honestly ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so. the opt command is the modular LLVM optimizer and analyzer. no cap. she takes LLVM source files as input, runs whatever optimizations or analyses you told her to run on them, and then outputs the optimized file. main character energy fr fr πŸ‘‘

the optimizations you actually get depend on what libraries were linked into her as well as any additional libraries that have been loaded with the -load option. so if you're like "why isn't this pass here" β€” bestie it's a linking thing. use the -help option to figure out which optimizations you can actually use. it's giving "check the menu before you order" πŸ“

if filename is omitted from the command line, or if it's literally just "-", then opt reads its input from standard input. love that for her. inputs can be in either:

  • the LLVM assembly language format, which is .ll
  • the LLVM bitcode format, which is .bc

and if you don't specify an output filename with the -o option, opt writes her output straight to standard output. classic πŸ’–


πŸ’… OPTIONS πŸ’…

here we go, the good part. every single one, no skipping, no summarizing, we are NOT that girl πŸ™ˆ

  • -f β€” enable binary output on terminals. normally, opt will refuse to write raw bitcode output if the output stream is a terminal. with this option, opt will write raw bitcode regardless of the output device. so basically she stops protecting you from yourself. use with intention bestie 🫢
  • -help β€” print a summary of command line options. the "girl help" of flags, except she actually delivers πŸ“‹
  • -o <filename> β€” specify the output filename. that's it, that's the whole job πŸ’«
  • -S β€” write output in LLVM intermediate language instead of bitcode. the human-readable option. the "let me see what's going on" option. we love her for it ✨
  • -passes=<string> β€” a textual (comma-separated) description of the pass pipeline. for example, -passes="sroa,instcombine". see invoking opt <../NewPassManager.html#invoking-opt> for more details on the pass pipeline syntax. this is where you tell her exactly which passes to run, in which order, and she does it. periodt πŸŽ€
  • -strip-debug β€” this option causes opt to strip debug information from the module before applying other optimizations. it's essentially the same as -strip, but it ensures that the stripping of debug information is done first. order matters, bestie 🧚
  • -verify-each β€” this option causes opt to add a verify pass after every pass otherwise specified on the command line, including -verify. this is useful for cases where it is suspected that a pass is creating an invalid module but it is not clear which pass is doing it. it's the "who made this mess" flag and honestly it's giving detective energy πŸ”
  • -stats β€” print statistics. numbers! for the nosy girlies πŸ“Š
  • --save-stats, --save-stats=cwd, --save-stats=obj β€” save LLVM statistics to a file in the current directory (--save-stats / "--save-stats=cwd") or in the directory of the output file ("--save-stats=obj"), in JSON format. she's saving receipts, literally πŸ’Ύ
  • -time-passes β€” record the amount of time needed for each pass and print it to standard error. the "who ate the most clock" report ⏱️
  • -debug β€” if this is a debug build, this option will enable debug printouts from passes which use the LLVM_DEBUG() macro. see the LLVM Programmer's Manual <../ProgrammersManual.html>, section #DEBUG for more information. note the "if this is a debug build" part β€” that's a whole conditional, don't come for me πŸ”₯
  • -load=<plugin> β€” load the dynamic object plugin. this object should register new optimization or analysis passes. once loaded, the object will add new command line options to enable various optimizations or analyses. to see the new complete list of optimizations, use the -help and -load options together. for example:
opt -load=plugin.so -help

that's the combo move right there. load then help. chef's kiss πŸ‘‘

  • -print-passes β€” print all available passes and exit. window shopping, no commitment πŸ›οΈ

🌈 EXIT STATUS 🌈

if opt succeeds, she will exit with 0. otherwise, if an error occurs, she will exit with a non-zero value. that's the whole contract. zero means we ate, non-zero means something went sideways 😭


πŸ’œ Author πŸ’œ

maintained by the LLVM Team (https://llvm.org/). they keep her fed and thriving 🫢


2003-2026, LLVM Project β€” that's the whole copyright line, no edits, no cap.


okay that's the whole page bestie, and here's your cute sign-off: this is opt(1) from the LLVM source, page 22, dated 2026-07-16. now go run some passes and be iconic with it πŸ’…βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from