OPT(1)
β¨ OPT(1) β it's giving "the LLVM optimizer" π
okay so bestie, pull up a chair, we're talking about opt from the LLVM manual, section 1 (that's the user commands section, iykyk). this is the glow-up page. let's get into it π«Ά
πΈ NAME πΈ
opt β the LLVM optimizer. literally what it says on the tin, no cap. β¨
π¦ SYNOPSIS π¦
opt [options] [filename]
that's it. that's the whole vibe. β¨
π DESCRIPTION π
okay so opt is the modular LLVM optimizer and analyzer π. here's the tea:
- it takes LLVM source files as input π
- it runs the optimizations or analyses you told it to run on them π₯
- then it outputs the optimized file π
and here's the part that gets people: the optimizations available via opt depend upon what libraries were linked into it, as well as any additional libraries that have been loaded with the -load option. so like, it's not a fixed menu, it's a build-your-own-sundae situation π¨. to find out what optimizations you can actually use, hit up the -help option. periodt.
now, about input π₯: if filename is omitted from the command line, or is "-", then opt reads its input from standard input. flexible queen π
.
inputs can be in either of these formats, and yes you can mix and match, she doesn't judge:
- LLVM assembly language format (
.ll) π - LLVM bitcode format (
.bc) π§
and for output π€: if you don't specify an output filename with the -o option, opt writes its output to the standard output. so like, if you don't tell her where to put it, she's just gonna yell it at your terminal. iconic honestly π.
π OPTIONS π
here come the flags, bestie. every single one. buckle up π¦
-fβ Enable binary output on terminals. normallyoptwill refuse to write raw bitcode output if the output stream is a terminal (she's polite like that π). with this option,optwill write raw bitcode regardless of the output device. so yeah, this is the "i know what i'm doing, let me cook" flag π.-helpβ print a summary of command line options. your bestie for figuring out what's even available β¨.-o <filename>β specify the output filename. that's the whole thing. where the output goes π€.-Sβ write output in LLVM intermediate language (instead of bitcode). the "give me the readable stuff please" flag π.-{passname}β okay this one is lowkey the main character π.optprovides the ability to run any of LLVM's optimization or analysis passes in any order. the-helpoption lists all the passes available. and here's the crucial bit: the order in which the options occur on the command line are the order in which they are executed (within pass constraints). so the order you type them = the order they run. sequencing matters, bestie, no cap π«Ά.-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 stripping of debug information is done first. order matters, we love a priority queen π .-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 a pass is creating an invalid module but it's not clear which pass is doing it β she snitches on the culprit π.-statsβ print statistics. numbers! data! π-time-passesβ record the amount of time needed for each pass and print it to standard error β±οΈ.-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 π.-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-helpand-loadoptions together. for example:
opt -load=plugin.so -help
-print-passesβ print all available passes and exit. she shows you the menu and then immediately leaves πͺπ¨.
π EXIT STATUS π
- if
optsucceeds, it will exit with0. we love a clean win π - otherwise, if an error occurs, it will exit with a non-zero value. something went wrong, bestie π
π«Ά AUTHOR π«Ά
maintained by the LLVM Team (<https://llvm.org/>). they're the ones keeping this whole thing running, respect π
β COPYRIGHT β
2003-2025, LLVM Project π
okay that's the whole page bestie, you ate that reading π and just so you know, this page is from the LLVM source, dated 2025-09-03 π go forth and optimize, no cap πβ¨π¦
π¦ where this page comes from
- fedora 43: llvm20 20.1.8-2.fc43 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 43: llvm20 20.1.8-2.fc43 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 44: llvm20 20.1.8-2.fc44 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 44: llvm20 20.1.8-2.fc44 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms