OPT(1)
π OPT(1) β the LLVM optimizer, but make it make sense π
okay so bestie, welcome to opt(1), the LLVM manual page. yes it's a manpage, no it doesn't have to be boring. let's get into it π
β¨ NAME β¨
opt β the LLVM optimizer. that's it, that's the vibe. it optimizes. it analyzes. it slays.
πΈ SYNOPSIS πΈ
opt [options] [filename]
π¦ DESCRIPTION π¦
so opt is literally the modular LLVM optimizer and analyzer, which is a fancy way of saying it does two jobs and does both of them iconically. it takes LLVM source files as input, runs whatever optimizations or analyses you told it to, and then outputs the optimized file. main character energy fr fr π«Ά
now here's the tea: the optimizations you can actually use through opt depend on what libraries were linked into it, plus any extra libraries you loaded with the -load option. so it's not a fixed menu, it's more like a customizable little outfit. use the -help option to figure out what optimizations you actually have access to π
if filename is omitted from the command line, or if it's -, then opt reads its input from standard input. and your inputs can be in either:
- the LLVM assembly language format (
.ll), or - the LLVM bitcode format (
.bc)
either one, no stress π
and if you don't specify an output filename with the -o option, opt writes its output to standard output. so like, it just goes straight out into the world. no cap.
π OPTIONS π
-fβ enable binary output on terminals. normallyoptwill straight up refuse to write raw bitcode output if the output stream is a terminal (it's giving protective bestie energy), but with this optionoptwill write raw bitcode regardless of the output device. do with that information what you will π-helpβ print a summary of command line options. your little cheat sheet. your map. your bestie pointing at the menu β¨-o <filename>β specify the output filename. that's the one.-Sβ write output in LLVM intermediate language instead of bitcode. so you get the human-readable-ish version, not the raw bytes. we love a readable moment π-{passname}β okay this is the big one, the iconic one.optgives you the ability to run any of LLVM's optimization or analysis passes, in any order. the-helpoption lists all the passes available to you. and the order in which the options occur on the command line is the order in which they get executed (within pass constraints β the constraints said no to total chaos π). so like, the way you list them? that's the way they run. periodt.-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 the stripping of debug information happens first. first! no cutting the line π§-verify-eachβ this option causesoptto add a verify pass after every pass otherwise specified on the command line (including-verify). this is useful for cases where it's suspected that a pass is creating an invalid module but it's not clear which pass is doing it. like a little detective checking everyone's work at the door π₯-statsβ print statistics. numbers! data! we love a quantified moment β-time-passesβ record the amount of time needed for each pass and print it to standard error. so you know exactly which pass is taking forever (there's always one π)-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. ngl this one's for the build engineers, but respect π«Ά-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
iconique. load it, then ask what it can do π
-print-passesβ print all available passes and exit. just a full roster, no further obligations, bye π
π EXIT STATUS π
if opt succeeds, it will exit with 0. otherwise, if an error occurs, it will exit with a non-zero value. clean success, messy failure, no in-between π€
π AUTHOR π
maintained by the LLVM Team (https://llvm.org/). absolute legends.
πΈ COPYRIGHT πΈ
2003-2025, LLVM Project
okay that's the whole page bestie, you're officially caught up. and yes, this was page 19, dated 2025-01-17, brought to you by the LLVM girlies. now go optimize something and make it iconic π¦πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· 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