In the beginning, Adam Nemet created the opt-viewer python script family, as part of LLVM. He presented it at the 2016 LLVM Developers’ Meeting, and lo it was good.
In a nutshell (watch the talk!) it is a tool for collecting optimization remarks generated by clang -fsave-optimization-record
, and displaying them beautifully integrated into htmls of the source files.
However, it was explicitly designed for use by compiler writers wishing to investigate and imporve optimization code, with a mention of future adaptation for usage by developers wishing to understand and improve their application's optimization.
That adaptation never happened - hence the birth of optview2. We aim to make this wonderful optimization data accessible and actionable by developers.
- Ignore system headers (all files outside the given source root)
- Collect only optimization failures,
- Display in index.html only a single entry per type/source loc
- Replace ‘pass’ with ‘optimization name’
- Make the index table sortable & resizable (Thanks Ilan Ben-Hagai)
- Use abridged func names
I don't see any potential compatibility considerations now or in the future, and these are essentially only 5 python scripts and some html+javascript - so at this point there won't be any versioning or releases structure.
Just download and use - and please report any problems you come across.
First, build your C/C++ project with Clang + -fsave-optimization-record
. Note that by default this generates YAMLs alongside the obj files. Then -
./optview2/opt-viewer.py --output-dir <HTMLs destination> --source-dir <source location> <YAMLs location>
./optview2/opt-viewer.py -j10 --output-dir <> --source-dir <> <>