OPT(1)
π OPT(1) β the LLVM optimizer, but make it make sense π
okay bestie, listen β this is the manual page for opt from the LLVM crew, and by the end of this you're gonna be running optimization passes like it's nothing. no cap. π¦
β¨ NAME β¨
opt β the LLVM optimizer. that's it, that's the whole vibe. she optimizes. π
β¨ SYNOPSIS β¨
opt [options] [filename]
literally just options and maybe a file. we love a simple girl. π
β¨ DESCRIPTION β¨
so opt is the modular LLVM optimizer and analyzer. she takes LLVM source files as input, runs whatever optimizations or analyses you told her to run, and then hands you back either the optimized file or the analysis results. the way she behaves depends entirely on whether you passed the -analyze option. main character energy, honestly β¨
when -analyze is specified, opt does a bunch of analyses of the input source. she'll usually print the results on standard output, but in a few cases she'll print output to standard error or straight-up generate a file with the analysis output β which, fyi, is usually what happens when the output is meant for another program. iykyk. π
when -analyze is not given, opt tries to produce an optimized output file instead. the optimizations you get through opt depend on what libraries were linked into it plus any extra libraries you loaded with the -load option. to find out which optimizations are actually available to you, use the -help option. go on, she tells you everything. π
if filename is omitted from the command line, or if it's literally β-β, 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). both icons, tbh. π
and if you don't specify an output filename with the -o option, opt writes its output to standard output. simple. gorgeous. no notes. πΈ
β¨ OPTIONS β¨
-fβ enables 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 regardless of the output device. chaotic. love her. π-helpβ prints a summary of command line options. your girl is an open book. π-o<filename>β specifies the output filename.-Sβ writes output in LLVM intermediate language instead of bitcode.-{passname}βoptcan run any of LLVM's optimization or analysis passes, in any order. the-helpoption lists all the passes available. and here's the tea: the order in which the options occur on the command line is the order in which they are executed (within pass constraints, obviously β she has boundaries). β¨-strip-debugβ makesoptstrip debug information from the module before applying other optimizations. it's essentially the same as-strip, but it makes sure that stripping of debug information happens first. first. always first. she's organized like that. π-verify-eachβ makesoptadd 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 you have no idea which pass is the culprit. it's giving detective. π-statsβ prints statistics. numbers! data! slay! π-time-passesβ records the amount of time needed for each pass and prints it to standard error. β±οΈ-debugβ if this is a debug build, this option enables debug printouts from passes that use theLLVM_DEBUG()macro. see the LLVM Programmer's Manual, section#DEBUGfor more info. nerd mode: activated. π€-load=<plugin>β loads the dynamic object plugin. this object should register new optimization or analysis passes. once loaded, the object adds 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β prints all available passes and exits. then she's out. bye bestie. π
β¨ EXIT STATUS β¨
if opt succeeds, she exits with 0. otherwise, if an error occurs, she exits with a non-zero value. she keeps it real either way. π―
β¨ AUTHOR β¨
maintained by the LLVM Team (https://llvm.org/). they're the ones keeping this whole thing alive, show them some love. π«Ά
β¨ COPYRIGHT β¨
2003-2025, LLVM Project β yeah, that's over two decades of optimization. generational. π
okay so quick recap before you go:opt= modular LLVM optimizer + analyzer,-analyzeflips her into analysis mode, no-analyzemeans optimized output file, no filename orβ-βmeans stdin, no-omeans stdout. the rest is just vibes and passes. π
and that's the whole page, bestie!! this was opt(1) from the LLVM manual, page 14, dated 2025-05-22. go optimize something iconic. πβ¨π¦
π¦ where this page comes from
- ubuntu questing: llvm-14 1:14.0.6-20ubuntu3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms