9 :program:`opt` [*options*] [*filename*]
14 The :program:`opt` command is the modular LLVM optimizer and analyzer. It takes
15 LLVM source files as input, runs the specified optimizations or analyses on it,
16 and then outputs the optimized file. The optimizations available via
17 :program:`opt` depend upon what libraries were linked into it as well as any
18 additional libraries that have been loaded with the :option:`-load` option. Use
19 the :option:`-help` option to determine what optimizations you can use.
21 If ``filename`` is omitted from the command line or is "``-``", :program:`opt`
22 reads its input from standard input. Inputs can be in either the LLVM assembly
23 language format (``.ll``) or the LLVM bitcode format (``.bc``).
25 If an output filename is not specified with the :option:`-o` option,
26 :program:`opt` writes its output to the standard output.
33 Enable binary output on terminals. Normally, :program:`opt` will refuse to
34 write raw bitcode output if the output stream is a terminal. With this option,
35 :program:`opt` will write raw bitcode regardless of the output device.
39 Print a summary of command line options.
41 .. option:: -o <filename>
43 Specify the output filename.
47 Write output in LLVM intermediate language (instead of bitcode).
49 .. option:: -{passname}
51 :program:`opt` provides the ability to run any of LLVM's optimization or
52 analysis passes in any order. The :option:`-help` option lists all the passes
53 available. The order in which the options occur on the command line are the
54 order in which they are executed (within pass constraints).
56 .. option:: -strip-debug
58 This option causes opt to strip debug information from the module before
59 applying other optimizations. It is essentially the same as `-strip`
60 but it ensures that stripping of debug information is done first.
62 .. option:: -verify-each
64 This option causes opt to add a verify pass after every pass otherwise
65 specified on the command line (including `-verify`). This is useful
66 for cases where it is suspected that a pass is creating an invalid module but
67 it is not clear which pass is doing it.
73 .. option:: -time-passes
75 Record the amount of time needed for each pass and print it to standard
80 If this is a debug build, this option will enable debug printouts from passes
81 which use the ``LLVM_DEBUG()`` macro. See the `LLVM Programmer's Manual
82 <../ProgrammersManual.html>`_, section ``#DEBUG`` for more information.
84 .. option:: -load=<plugin>
86 Load the dynamic object ``plugin``. This object should register new
87 optimization or analysis passes. Once loaded, the object will add new command
88 line options to enable various optimizations or analyses. To see the new
89 complete list of optimizations, use the :option:`-help` and :option:`-load`
90 options together. For example:
94 opt -load=plugin.so -help
96 .. option:: -print-passes
98 Print all available passes and exit.
103 If :program:`opt` succeeds, it will exit with 0. Otherwise, if an error
104 occurs, it will exit with a non-zero value.