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