1 llvm-opt-report - generate optimization report from YAML
2 ========================================================
4 .. program:: llvm-opt-report
9 :program:`llvm-opt-report` [*options*] [input]
14 :program:`llvm-opt-report` is a tool to generate an optimization report from YAML optimization record files.
16 You need to create an input YAML optimization record file before running :program:`llvm-opt-report`.
18 It provides information on the execution time, memory usage, and other details of each optimization pass.
21 .. code-block:: console
23 $ clang -c foo.c -o foo.o -O3 -fsave-optimization-record
25 Then, you create a report using the :program:`llvm-opt-report` command with the YAML optimization record file :file:`foo.opt.yaml` as input.
27 .. code-block:: console
29 $ llvm-opt-report foo.opt.yaml -o foo.lst
31 foo.lst is the generated optimization report.
37 2 | void foo() { bar(); }
39 4 | void Test(int *res, int *c, int *d, int *p, int n) {
42 7 | #pragma clang loop vectorize(assume_safety)
43 8 V4,1 | for (i = 0; i < 1600; i++) {
44 9 | res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
47 12 U16 | for (i = 0; i < 16; i++) {
48 13 | res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
53 18 | foo(); bar(); foo();
59 Symbols printed on the left side of the program indicate what kind of optimization was performed.
60 The meanings of the symbols are as follows:
62 - I: The function is inlined.
63 - U: The loop is unrolled. The following number indicates the unroll factor.
64 - V: The loop is vectorized. The following numbers indicate the vector length and the interleave factor.
68 If a specific line of code is output twice, it means that the same optimization pass was applied to that
69 line of code twice, and the pass was able to further optimize the code on the second iteration.
75 If ``input`` is "``-``" or omitted, :program:`llvm-opt-report` reads from standard
76 input. Otherwise, it will read from the specified filename.
78 If the :option:`-o` option is omitted, then :program:`llvm-opt-report` will send its output
79 to standard output. If the :option:`-o` option specifies "``-``", then the output will also
80 be sent to standard output.
85 Display available options.
89 Display the version of this program.
91 .. option:: --format=<string>
93 The format of the optimization record file.
94 The Argument is one of the following:
100 .. option:: --no-demangle
102 Do not demangle function names.
104 .. option:: -o=<string>
108 .. option:: -r=<string>
110 Root for relative input paths.
114 Do not include vectorization factors, etc.
119 :program:`llvm-opt-report` returns 0 on success. Otherwise, an error message is printed
120 to standard error, and the tool returns 1.