[clang] [NFC][clang] Split clang/lib/CodeGen/CGBuiltin.cpp into target-specific files (PR #132252)
Martin Storsjö via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 21 14:15:29 PDT 2025
mstorsjo wrote:
> > clang/lib/CodeGen/CGBuiltin.cpp is over 1MB long (>23k LoC), and can take minutes to recompile (depending on compiler and host system) when modified, and 5 seconds for clangd to update for every edit. Splitting this file was discussed in this thread:
>
> It looks like while this makes the individual files somewhat faster to compile, it makes the total time to compile all them _much_ higher, by a factor of more than 3. It adds 1% to the clang build time.
I'm also seeing an increase, but not quite that much.
With GCC 13, I previously saw this (for `CGBuiltin.cpp.o`):
```
real 1m23.524s
user 1m22.800s
sys 0m0.705s
```
Now I see this (for `CGBuiltin.cpp.o` and all the `TargetBuiltins` object files):
```
real 1m12.927s
user 2m29.557s
sys 0m3.611s
```
I tried looking at the compile time for the indiviual object files. The vast majority of them take around 5 seconds to compile here, but we have one single outlier - `TargetBuiltins/RISCV.cpp.o`:
```
real 1m9.225s
user 1m8.728s
sys 0m0.477s
```
So even if `RISCV.cpp` only has 425 lines, compiling this single file still takes >80% of the time it took the compile the previous file.
https://github.com/llvm/llvm-project/pull/132252
More information about the cfe-commits
mailing list