1OPT(1) LLVM OPT(1)
2
3
4
6 opt - LLVM optimizer
7
9 opt [options] [filename]
10
12 The opt command is the modular LLVM optimizer and analyzer. It takes
13 LLVM source files as input, runs the specified optimizations or analy‐
14 ses on it, and then outputs the optimized file. The optimizations
15 available via opt depend upon what libraries were linked into it as
16 well as any additional libraries that have been loaded with the -load
17 option. Use the -help option to determine what optimizations you can
18 use.
19
20 If filename is omitted from the command line or is "-", opt reads its
21 input from standard input. Inputs can be in either the LLVM assembly
22 language format (.ll) or the LLVM bitcode format (.bc).
23
24 If an output filename is not specified with the -o option, opt writes
25 its output to the standard output.
26
28 -f Enable binary output on terminals. Normally, opt will refuse to
29 write raw bitcode output if the output stream is a terminal.
30 With this option, opt will write raw bitcode regardless of the
31 output device.
32
33 -help Print a summary of command line options.
34
35 -o <filename>
36 Specify the output filename.
37
38 -S Write output in LLVM intermediate language (instead of bitcode).
39
40 -{passname}
41 opt provides the ability to run any of LLVM's optimization or
42 analysis passes in any order. The -help option lists all the
43 passes available. The order in which the options occur on the
44 command line are the order in which they are executed (within
45 pass constraints).
46
47 -strip-debug
48 This option causes opt to strip debug information from the mod‐
49 ule before applying other optimizations. It is essentially the
50 same as -strip but it ensures that stripping of debug informa‐
51 tion is done first.
52
53 -verify-each
54 This option causes opt to add a verify pass after every pass
55 otherwise specified on the command line (including -verify).
56 This is useful for cases where it is suspected that a pass is
57 creating an invalid module but it is not clear which pass is do‐
58 ing it.
59
60 -stats Print statistics.
61
62 -time-passes
63 Record the amount of time needed for each pass and print it to
64 standard error.
65
66 -debug If this is a debug build, this option will enable debug print‐
67 outs from passes which use the LLVM_DEBUG() macro. See the LLVM
68 Programmer's Manual, section #DEBUG for more information.
69
70 -load=<plugin>
71 Load the dynamic object plugin. This object should register new
72 optimization or analysis passes. Once loaded, the object will
73 add new command line options to enable various optimizations or
74 analyses. To see the new complete list of optimizations, use
75 the -help and -load options together. For example:
76
77 opt -load=plugin.so -help
78
79 -print-passes
80 Print all available passes and exit.
81
83 If opt succeeds, it will exit with 0. Otherwise, if an error occurs,
84 it will exit with a non-zero value.
85
87 Maintained by the LLVM Team (https://llvm.org/).
88
90 2003-2023, LLVM Project
91
92
93
94
9516 2023-07-20 OPT(1)