OPT(1)
π opt β the LLVM optimizer, but make it make sense π
ok so this is opt(1) from the LLVM fam β the modular LLVM optimizer and analyzer, and honestly she's kind of a big deal. bestie, let's get into it π«Ά
β¨ SYNOPSIS β¨
opt [options] [filename]
πΈ DESCRIPTION πΈ
okay so the opt command is literally the modular LLVM optimizer and analyzer. it takes LLVM source files as input, runs the optimizations or analyses you told it to run on them, and then spits out the optimized file. gorgeous, iconic, no notes π
the optimizations available through opt depend on what libraries were linked into it, plus any extra libraries you loaded in with the -load option. so like, your opt and my opt might not have the same bag of tricks β check with -help to see what optimizations you've actually got. iykyk β¨
if filename is omitted from the command line, or if it's -, then opt reads its input from standard input. inputs can be in either the LLVM assembly language format (.ll) or the LLVM bitcode format (.bc). she's flexible like that π¦
if you don't specify an output filename with the -o option, opt writes its output to the standard output. default behavior, lowkey slay.
π OPTIONS π
-fβ enables binary output on terminals. normallyoptwill refuse to write raw bitcode output if the output stream is a terminal (it's being protective of your poor little screen π). with this option,optwill write raw bitcode regardless of the output device. so yeah, you can override it, but likeβ¦ she warned you.-helpβ prints a summary of command line options. your bestie for figuring out what's even available π-o <filename>β specify the output filename. that's it, that's the whole job π-Sβ write output in LLVM intermediate language (instead of bitcode). so you get the readable.llvibe instead of the binary.bcvibe β¨-{passname}βoptprovides the ability to run any of LLVM's optimization or analysis passes, in any order. the-helpoption lists all the passes available. the order in which the options occur on the command line is the order in which they are executed (within pass constraints). so like, the order slays in a specific way β respect the constraints bestie π-strip-debugβ this option causesoptto 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. first come, first stripped π-verify-eachβ this option causesoptto add a verify pass after every pass otherwise specified on the command line (including-verify). super useful when you suspect some pass is creating an invalid module but you literally cannot tell which pass is doing it. she'll narc on them for you π΅οΈββοΈ-statsβ print statistics. numbers! data! we love her π-time-passesβ record the amount of time needed for each pass and print it to standard error. perfect for when you need to know exactly which pass is eating your whole afternoon π-debugβ if this is a debug build, this option will enable debug printouts from passes which use theLLVM_DEBUG()macro. see the LLVM Programmer's Manual <../ProgrammersManual.html>, section #DEBUG for more information. (note the "if this is a debug build" β she's conditional, not magic π)-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. and to see the new complete list of optimizations, use the-helpand-loadoptions together, like this:
opt -load=plugin.so -help
that's the move. load first, then -help, then go off π
-print-passesβ print all available passes and exit. short, sweet, informative, iconic β¨
π₯ EXIT STATUS π₯
if opt succeeds, it will exit with 0 π. otherwise, if an error occurs, it will exit with a non-zero value π. that's the whole vibe check.
π§ Author π§
maintained by the LLVM Team (https://llvm.org/). they're the main characters here, fr fr π
π Copyright π
2003-2026, LLVM Project β yeah, they've been at this a minute. respect the legacy π«Ά
okay that's the whole page bestie, go optimize something and slay πβ¨
signed, sealed, and delivered by the LLVM version 21 crew, dated 2026-05-15 β OPT(1), periodt π
π¦ where this page comes from
- fedora 44: llvm21 21.1.8-5.fc44 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 44: llvm21 21.1.8-5.fc44 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms