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:yamlyaml-strtabbitstream
--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.
π COPYRIGHT π
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
- fedora 43: llvm20 20.1.8-2.fc43 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 43: llvm20 20.1.8-2.fc43 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 44: llvm20 20.1.8-2.fc44 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 44: llvm20 20.1.8-2.fc44 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms