brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · ba10ba3 Raw
121 lines · plain
1llvm-opt-report - generate optimization report from YAML2========================================================3 4.. program:: llvm-opt-report5 6SYNOPSIS7--------8 9:program:`llvm-opt-report` [*options*] [input]10 11DESCRIPTION12-----------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:: console22 23 $ clang -c foo.c -o foo.o -O3 -fsave-optimization-record24 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:: console28 29 $ llvm-opt-report foo.opt.yaml -o foo.lst30 31foo.lst is the generated optimization report.32 33.. code-block::34 35 < foo.c36  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 72OPTIONS73-------74 75If ``input`` is "``-``" or omitted, :program:`llvm-opt-report` reads from standard76input. Otherwise, it will read from the specified filename.77 78If the :option:`-o` option is omitted, then :program:`llvm-opt-report` will send its output79to standard output.  If the :option:`-o` option specifies "``-``", then the output will also80be sent to standard output.81 82 83.. option:: --help84 85 Display available options.86 87.. option:: --version88 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 - yaml97 - bitstream98 99.. option:: --no-demangle100 101 Do not demangle function names.102 103.. option:: -o=<string>104 105 Output file.106 107.. option:: -r=<string>108 109 Root for relative input paths.110 111.. option:: -s112 113 Do not include vectorization factors, etc.114 115EXIT STATUS116-----------117 118:program:`llvm-opt-report` returns 0 on success. Otherwise, an error message is printed119to standard error, and the tool returns 1.120 121