OPT(1)

πŸ“¦
version 16.0.6 Β· 3 versions
, in ubuntu noble

πŸ‘‘ opt(1) β€” the LLVM optimizer, bestie edition πŸ’…

okay so real talk: this is the manual page for opt, section 1, straight outta LLVM. she's the modular optimizer and analyzer and she's literally carrying the whole toolchain on her back. no cap. 🫢


✨ NAME ✨

opt β€” the LLVM optimizer. that's it, that's the name, she's iconic, periodt. πŸŽ€


🌸 SYNOPSIS 🌸

opt [options] [filename]

yeah bestie that's the whole vibe. options, then a filename, and off you go. πŸ¦‹


πŸ’– DESCRIPTION πŸ’–

so opt is the modular LLVM optimizer and analyzer. what does that mean fr? it takes LLVM source files as input, runs whatever optimizations or analyses you told it to run, and then spits out the optimized file. that's the whole deal. ⭐

here's the tea though β€” which optimizations you actually get depends on what libraries were linked into opt when it was built, plus any extra libraries you loaded in with the -load option. so if your fave pass is missing, that's why. 😭

want the receipts on what you can actually run? use the -help option. she'll tell you everything you've got. πŸ‘‘

now, the input rules:

  • if filename is omitted from the command line, or if it's literally "-", opt reads its input from standard input. stdin bestie, we love her. πŸ’œ
  • inputs can be in either the LLVM assembly language format (.ll) or the LLVM bitcode format (.bc). both are valid, she's not picky. 🌈

and the output rules:

  • if you don't specify an output filename with the -o option, opt writes its output to standard output. yes, to your terminal. yes, it's giving chaos. it's fine. ✨

πŸŽ€ OPTIONS πŸŽ€

okay this is the main character section, let's go option by option, no skipping, I don't make the rules (I do, and the rule is we keep every single one). πŸ’…

  • -f β€” Enable binary output on terminals. normally opt will refuse to write raw bitcode output if the output stream is a terminal (she has boundaries πŸ’€), but with this option she'll write raw bitcode regardless of the output device. chaos mode: unlocked. πŸ”₯
  • -help β€” Print a summary of command line options. your bestie when you're lost. 🫢
  • -o <filename> β€” Specify the output filename. that's it. that's the whole thing. put your output somewhere specific. πŸ“
  • -S β€” Write output in LLVM intermediate language instead of bitcode. so, .ll energy instead of .bc energy. 🌸
  • -{passname} β€” okay this one's the moment. opt can run any of LLVM's optimization or analysis passes, in any order. the -help option lists all the passes available to you. and the order you put these options on the command line is the order they get executed in (within pass constraints, obviously, she's not feral). so stack 'em up like a playlist. 🎧
  • -strip-debug β€” causes opt to 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. she's a little extra about the ordering and honestly? valid. πŸ’…
  • -verify-each β€” causes opt to 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 literally cannot tell which one is doing it. detective mode. πŸ”
  • -stats β€” Print statistics. numbers, bestie, 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 the LLVM_DEBUG() macro. see the LLVM Programmer's Manual, section #DEBUG for more information. iykyk. πŸ›
  • -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. and to see the new complete list of optimizations, use the -help and -load options together. for example:
opt -load=plugin.so -help

see? together. dynamic duo. πŸ‘―

  • -print-passes β€” Print all available passes and exit. like a menu but for passes. πŸ“œ

πŸ’€ EXIT STATUS πŸ’€

  • if opt succeeds β†’ she exits with 0. slay. ✨
  • otherwise, if an error occurs β†’ she exits with a non-zero value. not slay, but honest. πŸ™ˆ

🌟 AUTHOR 🌟

Maintained by the LLVM Team (https://llvm.org/). give them their flowers. πŸ’


2003-2024, LLVM Project. all the rights, all the years. πŸ‘‘


and that's the page bestie!! footer said 15, dated 2024-04-14, and it's the OPT(1) manual β€” so like, LLVM, version 15 energy, spring 2024, page one. go optimize something gorgeous. πŸ’œπŸ¦‹βœ¨

πŸ“¦ where this page comes from