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 or the analysis results.
15 The function of opt depends on whether the -analyze option is given.
16
17 When -analyze is specified, opt performs various analyses of the input
18 source. It will usually print the results on standard output, but in a
19 few cases, it will print output to standard error or generate a file
20 with the analysis output, which is usually done when the output is
21 meant for another program.
22
23 While -analyze is not given, opt attempts to produce an optimized out‐
24 put file. The optimizations available via opt depend upon what li‐
25 braries were linked into it as well as any additional libraries that
26 have been loaded with the -load option. Use the -help option to deter‐
27 mine what optimizations you can use.
28
29 If filename is omitted from the command line or is "-", opt reads its
30 input from standard input. Inputs can be in either the LLVM assembly
31 language format (.ll) or the LLVM bitcode format (.bc).
32
33 If an output filename is not specified with the -o option, opt writes
34 its output to the standard output.
35
37 -f Enable binary output on terminals. Normally, opt will refuse to
38 write raw bitcode output if the output stream is a terminal.
39 With this option, opt will write raw bitcode regardless of the
40 output device.
41
42 -help Print a summary of command line options.
43
44 -o <filename>
45 Specify the output filename.
46
47 -S Write output in LLVM intermediate language (instead of bitcode).
48
49 -{passname}
50 opt provides the ability to run any of LLVM's optimization or
51 analysis passes in any order. The -help option lists all the
52 passes available. The order in which the options occur on the
53 command line are the order in which they are executed (within
54 pass constraints).
55
56 -disable-inlining
57 This option simply removes the inlining pass from the standard
58 list.
59
60 -disable-opt
61 This option is only meaningful when -std-link-opts is given. It
62 disables most passes.
63
64 -strip-debug
65 This option causes opt to strip debug information from the mod‐
66 ule before applying other optimizations. It is essentially the
67 same as -strip but it ensures that stripping of debug informa‐
68 tion is done first.
69
70 -verify-each
71 This option causes opt to add a verify pass after every pass
72 otherwise specified on the command line (including -verify).
73 This is useful for cases where it is suspected that a pass is
74 creating an invalid module but it is not clear which pass is do‐
75 ing it.
76
77 -stats Print statistics.
78
79 -time-passes
80 Record the amount of time needed for each pass and print it to
81 standard error.
82
83 -debug If this is a debug build, this option will enable debug print‐
84 outs from passes which use the LLVM_DEBUG() macro. See the LLVM
85 Programmer's Manual, section #DEBUG for more information.
86
87 -load=<plugin>
88 Load the dynamic object plugin. This object should register new
89 optimization or analysis passes. Once loaded, the object will
90 add new command line options to enable various optimizations or
91 analyses. To see the new complete list of optimizations, use
92 the -help and -load options together. For example:
93
94 opt -load=plugin.so -help
95
96 -p Print module after each transformation.
97
99 If opt succeeds, it will exit with 0. Otherwise, if an error occurs,
100 it will exit with a non-zero value.
101
103 Maintained by the LLVM Team (https://llvm.org/).
104
106 2003-2023, LLVM Project
107
108
109
110
11113 2023-07-20 OPT(1)