1OPT(1)                               LLVM                               OPT(1)
2
3
4

NAME

6       opt - LLVM optimizer
7

SYNOPSIS

9       opt [options] [filename]
10

DESCRIPTION

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

OPTIONS

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       -strip-debug
57              This option causes opt to strip debug information from the  mod‐
58              ule  before applying other optimizations.  It is essentially the
59              same as -strip but it ensures that stripping of  debug  informa‐
60              tion is done first.
61
62       -verify-each
63              This  option  causes  opt  to add a verify pass after every pass
64              otherwise specified on the  command  line  (including  -verify).
65              This  is  useful  for cases where it is suspected that a pass is
66              creating an invalid module but it is not clear which pass is do‐
67              ing it.
68
69       -stats Print statistics.
70
71       -time-passes
72              Record  the  amount of time needed for each pass and print it to
73              standard error.
74
75       -debug If this is a debug build, this option will enable  debug  print‐
76              outs from passes which use the LLVM_DEBUG() macro.  See the LLVM
77              Programmer's Manual, section #DEBUG for more information.
78
79       -load=<plugin>
80              Load the dynamic object plugin.  This object should register new
81              optimization  or  analysis passes.  Once loaded, the object will
82              add new command line options to enable various optimizations  or
83              analyses.   To  see  the new complete list of optimizations, use
84              the -help and -load options together.  For example:
85
86                 opt -load=plugin.so -help
87
88       -print-passes
89              Print all available passes and exit.
90

EXIT STATUS

92       If opt succeeds, it will exit with 0.  Otherwise, if an  error  occurs,
93       it will exit with a non-zero value.
94

AUTHOR

96       Maintained by the LLVM Team (https://llvm.org/).
97
99       2003-2022, LLVM Project
100
101
102
103
10414                                2022-03-23                            OPT(1)
Impressum