LLVM-OPT-REPORT(1)

πŸ’– LLVM-OPT-REPORT(1) πŸ’–

okay bestie, so this is the manual page for llvm-opt-report, part of the LLVM fam. Sit down, grab a strawberry drink πŸ“, and let's get into it.


✨ NAME ✨

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


🌸 SYNOPSIS 🌸

llvm-opt-report [options] [input]

πŸ¦‹ DESCRIPTION πŸ¦‹

llvm-opt-report is the tool that turns YAML optimization record files into an optimization report. it's giving "receipts for what the compiler actually did to your code" and honestly? obsessed. πŸ’…

ngl, you have to make an input YAML optimization record file before you run llvm-opt-report. no YAML, no report, no slay. πŸ™ˆ

it hands you the tea on the execution time, memory usage, and other deets of every single optimization pass. main character behaviour fr fr.

first, make the record file:

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

then you build 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. look at her:

< 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          |

so the little symbols chilling on the left side of the program? they're telling you what kind of optimization got performed. here's the decoder ring, bestie πŸ”₯:

  • I β€” the function is inlined. periodt.
  • U β€” the loop is unrolled. the number right after it is the unroll factor.
  • V β€” the loop is vectorized. the numbers after it are the vector length and the interleave factor.
NOTE: if a specific line of code shows up twice, that means the same optimization pass got applied to that line twice, and the pass was able to optimize the code even further on the second iteration. she kept going. we love a glow-up. ✨

πŸ’… OPTIONS πŸ’…

okay real talk, quick housekeeping first:

if input is - or you just... don't give one, llvm-opt-report reads from standard input. otherwise it reads from the filename you specified. πŸ’–

and if you skip the -o option, llvm-opt-report sends its output to standard output. if -o is set to -, the output also goes to standard output. either way you're getting fed. 🫢

  • --help β€” display the available options. the classic "what does this thing even do" button.
  • --version β€” display the version of this program. flex the build number. πŸ’…
  • --format=<string> β€” the format of the optimization record file. the argument is one of these three, no others, i don't make the rules:
    • yaml
    • yaml-strtab
    • bitstream
  • --no-demangle β€” do not demangle function names. leave them mangled, raw, unfiltered. 😭
  • -o=<string> β€” output file.
  • -r=<string> β€” root for relative input paths.
  • -s β€” do not include vectorization factors, etc. keep it minimal, keep it cute. πŸŽ€

πŸ”₯ EXIT STATUS πŸ”₯

llvm-opt-report returns 0 on success. otherwise, an error message gets printed to standard error, and the tool returns 1. that's the whole story. πŸ’€


πŸ‘‘ AUTHOR πŸ‘‘

maintained by the LLVM Team (https://llvm.org/). iconic behaviour only.


2003-2025, LLVM Project. all the rights, all the years, all the love. 🌈


okay that's the whole page bestie, go forth and generate reports πŸ¦‹βœ¨

sending you off with the official deets: this page came from the LLVM source, version dated 2025-09-03 β€” and the copyright belongs to the LLVM Project, 2003-2025. mwah, bye πŸ’–πŸ’…πŸŽ€

πŸ“¦ where this page comes from