[llvm] [CMAKE][llvm-libraries] Add Precompiled Headers option to improve build times (PR #91755)

Ameer J via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 18:37:01 PDT 2024


ameerj wrote:

> Thanks, that fixes the issue.

Thanks for testing and catching the bug!! :)

> Do you want to make the precompiled headers for CI build or for incremental local development?

The focus of this PR is on widely included headers, and I'm mainly interested in speeding up clean builds.
Even if these headers were often modified, they'd still be recompiling many files, so it's still beneficial for them to be in PCH.

> Have you thought about dependencies between PCH and generated headers? 
Personally I'm not excited about managing layering between PCH and various libraries but I'm curious to know your opinion.

This came to bite me today after rebasing. 
`Attributes.inc` is generated by a tablegen target, which depends on llvm-min-tblgen, which depends on LLVMSupport, which was using the PCH, which depends on `Attributes.inc`...
This was a surprise, as I'm used to header generation done at CMake config time, not during compilation. 

This is a problem I need to give more thought to, but for now, the fix I came up with is to simply make sure tablegenned headers in the PCH can generate before the PCH gets included by other targets.
This means header generating targets and all of their dependencies cannot include the PCH

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


More information about the llvm-commits mailing list