LLVM-OPT-REPORT(1)

πŸ’– LLVM-OPT-REPORT β€” the manual page, but make it make sense ✨

okay bestie, welcome to llvm-opt-report (that's the page title, section 1 of the LLVM manual, iykyk) πŸ’…


🌸 NAME 🌸

llvm-opt-report β€” generate an optimization report from YAML. that's it, that's the vibe 🫢


✨ SYNOPSIS ✨

llvm-opt-report [options] [input]

πŸ¦‹ DESCRIPTION πŸ¦‹

so like. llvm-opt-report is the tool that turns your YAML optimization record files into an actual optimization report. it's giving "receipts for your compiler" fr fr πŸ”₯

heads up: you need to make an input YAML optimization record file before you run llvm-opt-report. no input file, no report. periodt.

what does it actually give you? information on the execution time, memory usage, and other details of each optimization pass. so you can see exactly what the compiler was doing behind your back πŸ’€

first, generate the record file:

$ clang -c foo.c -o foo.o -O3 -fsave-optimization-record

then you make the report by running the llvm-opt-report command with the YAML optimization record file foo.opt.yaml as input:

$ llvm-opt-report foo.opt.yaml -o foo.lst

and foo.lst is the generated optimization report. iconic. πŸ‘‘

it looks like this:

< foo.c
 1          | void bar();
 2          | void foo() { bar(); }
 3          |
 4          | void Test(int *res, int *c, int *d, int *p, int n) {
 5          |   int i;
 6          |
 7          | #pragma clang loop vectorize(assume_safety)
 8     V4,1 |   for (i = 0; i < 1600; i++) {
 9          |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
10          |   }
11          |
12  U16     |   for (i = 0; i < 16; i++) {
13          |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
14          |   }
15          |
16 I        |   foo();
17          |
18          |   foo(); bar(); foo();
   I        |   ^
   I        |                 ^
19          | }
20          |

see those lil symbols printed on the left side of the program? those tell you what kind of optimization was performed. the meanings are as follows:

  • I β€” the function is inlined. it just moved in, no warning 🏠
  • U β€” the loop is unrolled. the following number indicates the unroll factor.
  • V β€” the loop is vectorized. the following numbers indicate the vector length and the interleave factor</interleave>.
πŸ“ Note: if a specific line of code is output twice, it means the same optimization pass was applied to that line of code twice, and the pass was able to further optimize the code on the second iteration. the compiler was like "actually, one more time" πŸ™ˆ

πŸ’œ OPTIONS πŸ’œ

quick lore drop before the list: if input is - or omitted, llvm-opt-report reads from standard input. otherwise, it will read from the specified filename.

and if the -o option is omitted, llvm-opt-report sends its output to standard output. if the -o option specifies -, the output will also be sent to standard output. same energy, either way 🫢

  • --help β€” display available options. the "what can u even do" button ✨
  • --version β€” display the version of this program.
  • --format=<string> β€” the format of the optimization record file. the argument is one of the following:
    • yaml
    • bitstream
  • --no-demangle β€” do not demangle function names. keeping the names raw and unedited, we respect the original πŸ’…
  • -o=<string> β€” output file.
  • -r=<string> β€” root for relative input paths.
  • -s β€” do not include vectorization factors, etc. minimalism, but make it compiler-flavored πŸŽ€

🌈 EXIT STATUS 🌈

llvm-opt-report returns 0 on success. otherwise, an error message is printed to standard error, and the tool returns 1. not a slay, but at least it tells you 😭


πŸ‘‘ Author πŸ‘‘

Maintained by the LLVM Team (https://llvm.org/).

2003-2026, LLVM Project


okay that's the whole page bestie, tysm for reading 🫢 this was LLVM-OPT-REPORT(1) from the LLVM manual, dated 2026-07-16, sitting pretty on page 22 β€” main character energy, no cap. go optimize something and slay πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from