LLVM-OPT-REPORT(1)
π LLVM-OPT-REPORT(1) β llvm-opt-report
okay so bestie, this is the llvm-opt-report page from the LLVM manual set, and honestly? it's giving "compiler girlie explains her homework" energy. let's get into it π«Ά
β¨ NAME β¨
llvm-opt-report β generate optimization report from YAML π
πΈ SYNOPSIS πΈ
llvm-opt-report [options] [input]
literally that's it. options, then a file. slay.
π¦ DESCRIPTION π¦
so llvm-opt-report is a tool that generates an optimization report from YAML optimization record files. that's its whole job and it does it beautifully π
β οΈ important bestie: you need to create an input YAML optimization record file before running llvm-opt-report. no input file, no report. it can't manifest one out of vibes.
it provides info on the execution time, memory usage, and other details of each optimization pass. like a little receipt for what the compiler did to your code π§Ύβ¨
$ clang -c foo.c -o foo.o -O3 -fsave-optimization-record
then (main character step two) you create a report using 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 π like, that's the whole arc.
< 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 |
ok so the symbols printed on the left side of the program? they indicate what kind of optimization was performed. the meanings are as follows, and yes i memorized them π
Iβ the function is inlined.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.
### π 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. not a bug, not a glitch, it's just her working overtime ππ₯
β OPTIONS β
first, the input situation (iykyk): if input is - or omitted, llvm-opt-report reads from standard input. otherwise, it will read from the specified filename.
and the output situation: if the -o option is omitted, then llvm-opt-report will send its output to standard output. if the -o option specifies -, then the output will also be sent to standard output. same vibe either way π«Ά
--helpβ display available options.--versionβ display the version of this program.--format=<string>β the format of the optimization record file. the argument is one of the following:yamlyaml-strtabbitstream
--no-demangleβ do not demangle function names.-o=<string>β output file.-r=<string>β root for relative input paths.-sβ do not include vectorization factors, etc.
π₯ EXIT STATUS π₯
llvm-opt-report returns 0 on success. otherwise, an error message is printed to standard error, and the tool returns 1. no in-between, it's binary babe πβ¨
π AUTHOR π
maintained by the LLVM Team (https://llvm.org/). icons, honestly π
π COPYRIGHT π
2003-2025, LLVM Project
and that's the whole page bestie π one last lil sign-off: this was LLVM 19, dated <yellow>2025-01-17</yellow>, and it ate. periodt π
β¨π¦
π¦ where this page comes from
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms