OPT(1)
π opt(1) β the LLVM optimizer, bestie edition π
okay so real talk: this is the manual page for opt, section 1, straight outta LLVM. she's the modular optimizer and analyzer and she's literally carrying the whole toolchain on her back. no cap. π«Ά
β¨ NAME β¨
opt β the LLVM optimizer. that's it, that's the name, she's iconic, periodt. π
πΈ SYNOPSIS πΈ
opt [options] [filename]
yeah bestie that's the whole vibe. options, then a filename, and off you go. π¦
π DESCRIPTION π
so opt is the modular LLVM optimizer and analyzer. what does that mean fr? it takes LLVM source files as input, runs whatever optimizations or analyses you told it to run, and then spits out the optimized file. that's the whole deal. β
here's the tea though β which optimizations you actually get depends on what libraries were linked into opt when it was built, plus any extra libraries you loaded in with the -load option. so if your fave pass is missing, that's why. π
want the receipts on what you can actually run? use the -help option. she'll tell you everything you've got. π
now, the input rules:
- if
filenameis omitted from the command line, or if it's literally"-",optreads its input from standard input. stdin bestie, we love her. π - inputs can be in either the LLVM assembly language format (
.ll) or the LLVM bitcode format (.bc). both are valid, she's not picky. π
and the output rules:
- if you don't specify an output filename with the
-ooption,optwrites its output to standard output. yes, to your terminal. yes, it's giving chaos. it's fine. β¨
π OPTIONS π
okay this is the main character section, let's go option by option, no skipping, I don't make the rules (I do, and the rule is we keep every single one). π
-fβ Enable binary output on terminals. normallyoptwill refuse to write raw bitcode output if the output stream is a terminal (she has boundaries π), but with this option she'll write raw bitcode regardless of the output device. chaos mode: unlocked. π₯-helpβ Print a summary of command line options. your bestie when you're lost. π«Ά-o <filename>β Specify the output filename. that's it. that's the whole thing. put your output somewhere specific. π-Sβ Write output in LLVM intermediate language instead of bitcode. so,.llenergy instead of.bcenergy. πΈ-{passname}β okay this one's the moment.optcan run any of LLVM's optimization or analysis passes, in any order. the-helpoption lists all the passes available to you. and the order you put these options on the command line is the order they get executed in (within pass constraints, obviously, she's not feral). so stack 'em up like a playlist. π§-strip-debugβ causesoptto strip debug information from the module before applying other optimizations. it's essentially the same as-stripbut it ensures that stripping of debug information is done first. she's a little extra about the ordering and honestly? valid. π-verify-eachβ 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 one is doing it. detective mode. π-statsβ Print statistics. numbers, bestie, numbers. π-time-passesβ Record the amount of time needed for each pass and print it to standard error. so you can find out exactly which pass is eating your 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, section #DEBUG for more information. iykyk. π-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. for example:
opt -load=plugin.so -help
see? together. dynamic duo. π―
-print-passesβ Print all available passes and exit. like a menu but for passes. π
π EXIT STATUS π
- if
optsucceeds β she exits with0. slay. β¨ - otherwise, if an error occurs β she exits with a non-zero value. not slay, but honest. π
π AUTHOR π
Maintained by the LLVM Team (https://llvm.org/). give them their flowers. π
β COPYRIGHT β
2003-2024, LLVM Project. all the rights, all the years. π
and that's the page bestie!! footer said 15, dated 2024-04-14, and it's the OPT(1) manual β so like, LLVM, version 15 energy, spring 2024, page one. go optimize something gorgeous. ππ¦β¨
π¦ where this page comes from
- ubuntu noble: llvm-16 1:16.0.6-23ubuntu4 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms