1llvm-opt-report - generate optimization report from YAML
2========================================================
3
4.. program:: llvm-opt-report
5
6SYNOPSIS
7--------
8
9:program:`llvm-opt-report` [*options*] [input]
10
11DESCRIPTION
12-----------
13
14:program:`llvm-opt-report` is a tool to generate an optimization report from YAML optimization record files.
15
16You need to create an input YAML optimization record file before running :program:`llvm-opt-report`.
17
18.. code-block:: console
19
20 $ clang -c foo.c -o foo.o -O3 -fsave-optimization-record
21
22Then, you create a report using the :program:`llvm-opt-report` command with the YAML optimization record file :file:`foo.opt.yaml` as input.
23
24.. code-block:: console
25
26 $ llvm-opt-report foo.opt.yaml -o foo.lst
27
28foo.lst is the generated optimization report.
29
30.. code-block::
31
32 < foo.c
33  1          | void bar();
34  2          | void foo() { bar(); }
35  3          |
36  4          | void Test(int *res, int *c, int *d, int *p, int n) {
37  5          |   int i;
38  6          |
39  7          | #pragma clang loop vectorize(assume_safety)
40  8     V4,1 |   for (i = 0; i < 1600; i++) {
41  9          |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
42 10          |   }
43 11          |
44 12  U16     |   for (i = 0; i < 16; i++) {
45 13          |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
46 14          |   }
47 15          |
48 16 I        |   foo();
49 17          |
50 18          |   foo(); bar(); foo();
51    I        |   ^
52    I        |                 ^
53 19          | }
54 20          |
55
56Symbols printed on the left side of the program indicate what kind of optimization was performed.
57The meanings of the symbols are as follows:
58
59- I: The function is inlined.
60- U: The loop is unrolled. The following number indicates the unroll factor.
61- V: The loop is vectorized. The following numbers indicate the vector length and the interleave factor.
62
63OPTIONS
64-------
65
66If ``input`` is "``-``" or omitted, :program:`llvm-opt-report` reads from standard
67input. Otherwise, it will read from the specified filename.
68
69If the :option:`-o` option is omitted, then :program:`llvm-opt-report` will send its output
70to standard output.  If the :option:`-o` option specifies "``-``", then the output will also
71be sent to standard output.
72
73
74.. option:: --help
75
76 Display available options.
77
78.. option:: --version
79
80 Display the version of this program.
81
82.. option:: --format=<string>
83
84 The format of the optimization record file.
85 The Argument is one of the following:
86
87 - yaml
88 - yaml-strtab
89 - bitstream
90
91.. option:: --no-demangle
92
93 Do not demangle function names.
94
95.. option:: -o=<string>
96
97 Output file.
98
99.. option:: -r=<string>
100
101 Root for relative input paths.
102
103.. option:: -s
104
105 Do not include vectorization factors, etc.
106
107EXIT STATUS
108-----------
109
110:program:`llvm-opt-report` returns 0 on success. Otherwise, an error message is printed
111to standard error, and the tool returns 1.
112
113