OPT(1)
β¨ OPT(1) β the LLVM optimizer, but make it a vibe β¨
okay bestie, welcome to the opt manual page π this is LLVM's very own section 1 page, and by the end of it you're gonna be running passes like it's nothing. no cap.
πΈ SYNOPSIS πΈ
opt [options] [filename]
π¦ DESCRIPTION π¦
So like, opt is the modular LLVM optimizer and analyzer. It's giving main character energy fr. You feed it LLVM source files as input, it runs whatever optimizations or analyses you asked for, and then it outputs either the optimized file or the analysis results. The whole personality of opt depends on whether you passed the -analyze option. Like, that flag is the vibe check. π
When -analyze is specified, opt runs a bunch of analyses on the input source. Usually it prints the results to standard output, but in a few cases it'll print to standard error or straight up generate a file with the analysis output β which is typically what happens when the output is meant for another program to consume. iykyk π«Ά
When -analyze is not given, opt tries to produce an optimized output file instead. Which optimizations you actually get depends on what libraries got linked into it, plus any extra libraries you loaded with the -load option. Not sure what's on the menu? Just hit the -help option and it'll tell you which optimizations you can use. periodt. β¨
If filename is omitted from the command line, or if it's "-", opt reads its input from standard input. Inputs can be in either the LLVM assembly language format (.ll) or the LLVM bitcode format (.bc). Both slay, honestly. π
And if you didn't specify an output filename with the -o option? opt writes its output to standard output. Simple as that, babe.
π OPTIONS π
-fβ enables binary output on terminals. Normallyoptflat out refuses to write raw bitcode output if the output stream is a terminal (it's being protective, okay π). With this option,optwrites raw bitcode no matter what the output device is.-helpβ prints a summary of the command line options. your bestie when you're lost. π-o <filename>β specify the output filename. that's it, that's the whole thing.-Sβ write output in LLVM intermediate language instead of bitcode. iconic behavior.-{passname}βoptlets you run any of LLVM's optimization or analysis passes, in any order. The-helpoption lists all the passes available. The order the options show up on the command line is the order they get executed in (within pass constraints, obviously, we're not chaotic). π₯-disable-inliningβ simply removes the inlining pass from the standard list. bye bestie π-disable-optβ this one is only meaningful when-std-link-optsis given. It disables most passes.-strip-debugβ causesoptto strip debug information from the module before applying other optimizations. It's essentially the same as-strip, except it guarantees that the stripping of debug information happens first. order matters, queen. π-verify-eachβ causesoptto add a verify pass after every pass otherwise specified on the command line (including-verify). This is so useful when you suspect a pass is creating an invalid module but you have no idea which pass is the culprit. detective mode activated π΅οΈ-statsβ print statistics.-time-passesβ record the amount of time needed for each pass and print it to standard error. clocking the girls β±οΈ-debugβ if this is a debug build, this option enables debug printouts from passes which use theLLVM_DEBUG()macro. See the LLVM Programmer's Manual, section#DEBUGfor more info.-load=<plugin>β load the dynamic object plugin. This object should register new optimization or analysis passes. Once it's loaded, the object adds new command line options to enable various optimizations or analyses. Wanna 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. little progress pics for your IR πΈ
π EXIT STATUS π
If opt succeeds, it exits with 0. Otherwise, if an error occurs, it exits with a non-zero value. no in-between, she's decisive.
π«Ά AUTHOR π«Ά
Maintained by the LLVM Team (<https://llvm.org/>). yes they're the blueprint, we love them.
π COPYRIGHT π
2003-2024, LLVM Project
and that's the whole page bestie π this was opt from the LLVM manual, page 12, dated 2024-07-18 β go optimize something and make it iconic β¨π
π¦ where this page comes from
- fedora 43: llvm12 12.0.1-12.fc41 Β· NCSA
- fedora 43: llvm12 12.0.1-12.fc41 Β· NCSA
- fedora 44: llvm12 12.0.1-12.fc41 Β· NCSA
- fedora 44: llvm12 12.0.1-12.fc41 Β· NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms