Hi Folks,
Inspired by the work on faster Linux kernel build [0], I’ve started to cleanup the LLVM headers, helped by iwyu [1] (but not in an automatic way, the tool has some limitations wrt. LLVM codebase).
Why such a cleanup?
- Speedup builds by having smaller compilation units. In current state, on my laptop, I’ve been able to rebuild libLLVMDebugInfoDWARF.so in 7m01s using 3 cores, compared to a base run of 7m11s. Not a 10% speedup, but still a decent step at this stage
- Please incremental builds: less dependencies imply less rebuilds when one touches a header
- More informative includes: reading the header gives a decent approximation of the requirements of the CU
What kind of cleanup?
- Remove unused forward declaration of types
- Add forward declaration of types instead of header inclusion
- Remove headers that don’t bring any used identifier
Can I see the patch?
I’ve not submitted it to phabricator yet, but I’m unsure it will be a pleasant read… I’m still balancing the best way to have it reviewed (maybe it’s not even meant to be reviewed…)
I’ve done roughly 33% of the header cleanup, before I go one, I’ll happily take feedback about the approach.
[0] [PATCH 0000/2297] [ANNOUNCE, RFC] "Fast Kernel Headers" Tree -v1: Eliminate the Linux kernel's "Dependency Hell"
[1] https://include-what-you-use.org/