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:yamlbitstream
--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/).
π Copyright π
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
- fedora 44: llvm 22.1.8-4.fc44 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 44: llvm 22.1.8-4.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