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 18It provides information on the execution time, memory usage, and other details of each optimization pass. 19 20 21.. code-block:: console 22 23 $ clang -c foo.c -o foo.o -O3 -fsave-optimization-record 24 25Then, you create a report using the :program:`llvm-opt-report` command with the YAML optimization record file :file:`foo.opt.yaml` as input. 26 27.. code-block:: console 28 29 $ llvm-opt-report foo.opt.yaml -o foo.lst 30 31foo.lst is the generated optimization report. 32 33.. code-block:: 34 35 < foo.c 36 1 | void bar(); 37 2 | void foo() { bar(); } 38 3 | 39 4 | void Test(int *res, int *c, int *d, int *p, int n) { 40 5 | int i; 41 6 | 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]; 45 10 | } 46 11 | 47 12 U16 | for (i = 0; i < 16; i++) { 48 13 | res[i] = (p[i] == 0) ? res[i] : res[i] + d[i]; 49 14 | } 50 15 | 51 16 I | foo(); 52 17 | 53 18 | foo(); bar(); foo(); 54 I | ^ 55 I | ^ 56 19 | } 57 20 | 58 59Symbols printed on the left side of the program indicate what kind of optimization was performed. 60The meanings of the symbols are as follows: 61 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. 65 66.. note:: 67 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. 70 71 72OPTIONS 73------- 74 75If ``input`` is "``-``" or omitted, :program:`llvm-opt-report` reads from standard 76input. Otherwise, it will read from the specified filename. 77 78If the :option:`-o` option is omitted, then :program:`llvm-opt-report` will send its output 79to standard output. If the :option:`-o` option specifies "``-``", then the output will also 80be sent to standard output. 81 82 83.. option:: --help 84 85 Display available options. 86 87.. option:: --version 88 89 Display the version of this program. 90 91.. option:: --format=<string> 92 93 The format of the optimization record file. 94 The Argument is one of the following: 95 96 - yaml 97 - yaml-strtab 98 - bitstream 99 100.. option:: --no-demangle 101 102 Do not demangle function names. 103 104.. option:: -o=<string> 105 106 Output file. 107 108.. option:: -r=<string> 109 110 Root for relative input paths. 111 112.. option:: -s 113 114 Do not include vectorization factors, etc. 115 116EXIT STATUS 117----------- 118 119:program:`llvm-opt-report` returns 0 on success. Otherwise, an error message is printed 120to standard error, and the tool returns 1. 121 122