LLVM-OPT-REPORT(1)

πŸ“¦
version 16.0.6 Β· 3 versions
, in ubuntu noble

✨ LLVM-OPT-REPORT ✨

okay bestie, gather round πŸ’– this is the llvm-opt-report page from the LLVM manual set, and she is literally the girl who reads your compiler's diary and turns it into a whole report. no cap.


🌸 NAME 🌸

llvm-opt-report β€” generate optimization report from YAML πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

llvm-opt-report [options] [input]

πŸ’… DESCRIPTION πŸ’…

so llvm-opt-report is a tool that generates an optimization report, and it pulls that report straight out of YAML optimization record files. that's her whole thing, she ate πŸ”₯

but listen β€” you have to make an input YAML optimization record file first before you run llvm-opt-report. she can't report on a vibe that doesn't exist yet, iykyk.

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

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

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

and foo.lst? that's the generated optimization report, bestie, she's born ✨

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

the little symbols printed on the left side of the program are telling you what kind of optimization went down πŸ‘‘ the meanings of the symbols are as follows:

  • I: the function is inlined.
  • U: the loop is unrolled. the number right after it tells you the unroll factor.
  • V: the loop is vectorized. the numbers right after it tell you the vector length and the interleave factor.

🌈 OPTIONS 🌈

if input is - or you just don't give one at all, llvm-opt-report reads from standard input. otherwise she reads from the filename you specified, periodt.

if the -o option is omitted, then llvm-opt-report sends her output to standard output. and if the -o option specifies -, then the output also goes to standard output. same vibe, either way 🫢

  • --help β€” display available options. she'll show you the menu, bestie πŸ’–
  • --version β€” display the version of this program. so you know exactly which girl you're talking to.
  • --format=<string> β€” the format of the optimization record file. the argument is one of the following:
    • yaml
    • yaml-strtab
    • bitstream
  • --no-demangle β€” do not demangle function names. leave them exactly as the compiler left them, raw and unbothered πŸ™ˆ
  • -o=<string> β€” output file.
  • -r=<string> β€” root for relative input paths.
  • -s β€” do not include vectorization factors, etc. keep it lowkey, minimal, no extra numbers.

πŸ’€ EXIT STATUS πŸ’€

llvm-opt-report returns 0 on success. otherwise, an error message gets printed to standard error, and the tool returns 1. not the slay we wanted, but she's honest about it 😭


🧚 AUTHOR 🧚

maintained by the LLVM Team (https://llvm.org/). they're the ones keeping her iconic πŸ‘‘


2003-2024, LLVM Project


and that's the whole page, babe β€” this one came to you as version 15, dated 2024-04-14, straight out of the LLVM-OPT-REPORT(1) section of the manual. go make a report, you're the main character now 🌟

πŸ“¦ where this page comes from