OPT(1)
π OPT(1) β the LLVM optimizer, but make it make sense
okay so bestie, welcome to opt, the LLVM one. This page is from the LLVM manual set (section 1, we're fancy like that) and it's literally just the optimizer. Let me walk you through it π«Ά
β¨ NAME β¨
opt β the LLVM optimizer. that's her. that's the whole name. iconic π
π¦ SYNOPSIS π¦
opt [options] [filename]
yes queen, that's it. options, maybe a filename, go off β¨
πΈ DESCRIPTION πΈ
okay so the tea β: opt is the modular LLVM optimizer and analyzer. She's modular, she's flexible, she contains multitudes.
Here's the vibe: you hand her LLVM source files as input, she runs whatever optimizations or analyses you asked for on them, and then she hands you back the optimized file. Main character energy all around π
Now β which optimizations can you actually use? That depends on what libraries were linked into her when she was built, plus any extra libraries you loaded in with the -load option. So it's giving "your mileage may vary" but in the most literal way possible. Use the -help option to figure out what optimizations you actually have available, bestie. Don't guess, just ask her π
More details you need to know:
- If
filenameis omitted from the command line, or if it's literally just-,optreads its input from standard input. Very chill of her. - Inputs can be in either the LLVM assembly language format (
.ll) or the LLVM bitcode format (.bc). Either one, she speaks both β¨ - If you don't specify an output filename with the
-ooption,optwrites her output to the standard output. no-o, no problem π«
π OPTIONS π
here's the full menu, no skips, no cuts, we're listing every single one because I'm not doing you dirty like that π
-fβ Enable binary output on terminals. Normallyoptwill refuse to write raw bitcode output if the output stream is a terminal (she's protecting you, and honestly? valid). With this option she'll write raw bitcode regardless of what the output device is. So like, she stops checking. You've been warned bestie π-helpβ Print a summary of command line options. the classic "what can you even do" button π-o <filename>β Specify the output filename. where she drops her work π-Sβ Write output in LLVM intermediate language (instead of bitcode). Reading it with your eyeballs? this one's for you β¨-{passname}β okay this is the good part π₯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 sequence you type is the sequence she runs. Order matters, bestie, don't come for me when it does π-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. same energy, but first in line π-verify-eachβ This option causesoptto add a verify pass after every pass otherwise specified on the command line (including-verify). Useful for cases where you suspect a pass is creating an invalid module but it's genuinely not clear which pass is doing it. detective mode π she checks after literally every step-statsβ Print statistics. 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#DEBUGfor more information. (note: if this is a debug build β normal builds, she stays quiet π)-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
like adding DLC to your compiler, genuinely obsessed π§
-print-passesβ Print all available passes and exit. just the list, nothing else, then she's out βοΈ
β 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 rule.
πΊ AUTHOR πΊ
Maintained by the LLVM Team (https://llvm.org/). the group chat admins fr fr π«Ά
π COPYRIGHT π
2003-2023, LLVM Project. all the legal bits, respectfully preserved π
lowkey reminder bestie: every fact above is exactly what the page says β nothing added, nothing skipped. if a pass blows up your module, that's between you and -verify-each π
and that's the page!! π written on 2023-01-14, page 15 of the manual, straight from the LLVM Project β mwah, go optimize something gorgeous π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: llvm15 15.0.7-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm15 15.0.7-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm15 15.0.7-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm15 15.0.7-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms