[clang] [NFC][clang] Remove superfluous header files after refactor in #132252 (PR #132495)

Jonathan Thackray via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 25 02:52:10 PDT 2025


jthackray wrote:

> LGTM. Does this actually fix the build time regression from the previous patch?

Apologies for the delay; I wasn't working yesterday.

Using a Graviton c8g.8xlarge instance, with a `ninja` build, I don't see a large build time regression. However, this is compiling in parallel, and I appreciate that official `llvmbot` builders may be building sequentially, which may see them take (wall-clock) longer (even if CPU used time is similar).

Build times are also quite compiler-dependent. GCC takes a _lot_ longer than clang, especially for the previously-mentioned RISC-V file `riscv_vector_builtin_cg.inc`, about 3.3MB in size, that gets #included.

Using clang 18 to compile a full `ninja` build after a `ninja clean` of the entire `llvm-project` source tree:
```
Before CGBuiltin.cpp split:
  real 351.41
  user 10275.13
  sys 471.73

After CGBuiltin.cpp split:
  real 353.28
  user 10342.80
  sys 472.39

After removing superfluous header files:
  real 353.46
  user 10337.66
  sys 474.88
```
i.e. 2 seconds longer build time.

However, with gcc 13 compiling, using `ninja` a full build of `llvm-project`, I see:
```
Before CGBuiltin.cpp split:
  real 631.64
  user 11160.92
  sys 685.47

After CGBuiltin.cpp split:
  real 574.28
  user 11214.63
  sys 691.98
```

If only `CGBuiltin.cpp` and `ARM.cpp` is touched/updated, I see a large difference (this was what prompted me to investigate originally as I was updating ARM intrinsics; it turns out the vast majority of the time is spent compiling the RISC-V code (`riscv_vector_builtin_cg.inc`, ~3.3MB in size) which was previously #included in `CGBuiltin.cpp`):

```
clang 18 - before CGBuiltin.cpp split:
  real 35.47
  user 39.84
  sys 3.08

clang 18 - after split:
  real 16.00
  user 30.02
  sys 3.44
```
and:
```
gcc 13 - before CGBuiltin.cpp split:
  real 397.02 (yes, it takes 5 minutes on Graviton 4 to recompile CGBuiltin.cpp)
  user 400.35
  sys 5.54

gcc 13 - after split:
  real 49.55
  user 65.88
  sys 5.29
```

https://github.com/llvm/llvm-project/pull/132495


More information about the cfe-commits mailing list