OPT(1)
β¨ NAME β¨
okay bestie, gather round π this is opt β the LLVM optimizer, and she's the main character of your whole compiler pipeline. (It's a page from the LLVM manual, section 1, iykyk.)
π¦ SYNOPSIS π¦
opt [options] [filename]
πΈ DESCRIPTION πΈ
so opt is the modular LLVM optimizer and analyzer β she does both, she contains multitudes π
. You hand her LLVM source files as input, she runs whatever optimizations or analyses you asked for, and then she gives you back the optimized file or the analysis results. Which of those two things she does depends entirely on whether you passed the -analyze option. It's giving two moods, one binary.
When -analyze is specified, opt runs a bunch of analyses on your input source. Most of the time she'll print the results to standard output, but in a few cases she'll print to standard error instead, or straight-up generate a file with the analysis output β which usually happens when that output is meant to be eaten by another program. π
When -analyze is not given, opt tries to produce an optimized output file. Now listen, the optimizations you can actually use through opt depend on what libraries got linked into her, plus any extra libraries you loaded with the -load option. So use the -help option to see what optimizations you've got available. No guessing, bestie, just ask her. β¨
If filename is omitted from the command line, or if it's just -, 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) β either one, she's flexible. π
And if you don't specify an output filename with the -o option, opt writes her output to standard output. Default behaviour, no notes.
π OPTIONS π
-fβ Enable binary output on terminals. Normallyoptrefuses to write raw bitcode output when the output stream is a terminal, but with this option she'll write raw bitcode no matter what the output device is. She's being brave, okay π-helpβ Print a summary of command line options.-o <filename>β Specify the output filename.-Sβ Write output in LLVM intermediate language instead of bitcode.-{passname}βoptcan run any of LLVM's optimization or analysis passes, in any order, and that's iconic honestly. The-helpoption lists all the passes available. The order in which the options occur on the command line is the order in which they get executed (within pass constraints, obviously β she has rules).-disable-inliningβ This option simply removes the inlining pass from the standard list. Gone. Not invited.-disable-optβ This option is only meaningful when-std-link-optsis given. It disables most passes. (Read that again: only meaningful with-std-link-opts. Otherwise she's just standing there.)-strip-debugβ This option causesoptto strip debug information from the module before applying other optimizations. It's essentially the same as-strip, except it makes sure the stripping of debug information happens first. Order matters, periodt.-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 have no idea which one is doing it. Detective mode π₯-statsβ Print statistics.-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#DEBUGfor 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
-pβ Print module after each transformation. She's showing her work π
π EXIT STATUS π
If opt succeeds, she exits with 0. Otherwise, if an error occurs, she exits with a non-zero value. That's it, that's the whole vibe check.
π AUTHOR π
Maintained by the LLVM Team (https://llvm.org/).
π COPYRIGHT π
2003-2024, LLVM Project
okay that's the whole page bestie, go optimize something slay π
β¨ this was opt, from LLVM, version 11, dated 2024-07-18 β mwah, love u, bye π«ΆπΈ
π¦ where this page comes from
- fedora 43: llvm11 11.1.0-14.fc41 Β· NCSA
- fedora 43: llvm11 11.1.0-14.fc41 Β· NCSA
- fedora 44: llvm11 11.1.0-14.fc41 Β· NCSA
- fedora 44: llvm11 11.1.0-14.fc41 Β· NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms