This patch implements PCH support. PCH is enabled by default, unless noted below, and can be disabled with -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON. * Libraries can define precompiled headers using a newly added PRECOMPILE_HEADERS keyword. If specified, the listed headers will be compiled into a pre-compiled header using standard CMake mechanisms. * Libraries that don't define their own PRECOMPILE_HEADERS but directly depend on a library or component that defines its own PCH will reuse that PCH. This reuse is not transitive to prevent excessive use of unrelated headers. If multiple dependencies provide a reusable PCH, the first one with the longest dependency chain (stored in the CMake target property LLVM_PCH_PRIORITY) is used. However, due to CMake limitations, only PCH from targets that are already defined can be reused; therefore libraries that should reuse a PCH must be defined later in the CMake file (=> add_subdirectory order matters). * Libraries and executables can prevent PCH reuse with the keyword DISABLE_PCH_REUSE. This both prevents reuse from dependencies and reuse by other dependants. This is useful when, e.g., internal headers are used in the PCH or the used headers are unlikely to provide benefits for dependants. * Precompiled headers are only used for C++ sources, not for C. * With GCC, PCH provide very little benefits (tested with GCC 14 and 15) due to increased template instatiation costs, but substantially increase max-rss and build directory size. Therefore, disable PCH with GCC by default; this can be explicitly overridden on the command line with -DCMAKE_DISABLE_PRECOMPILE_HEADERS=OFF. * With ccache and non-Clang compilers, changes in macro definitions are not always accurately forwarded with ccache's preprocessed mode. To be on the safe side, when ccache is enabled, disable PCH with all non-Clang compilers; this can be explicitly overridden. * With sccache, changes in macro definitions are not identified, which in some cases can lead to false positive cache hits. Conservatively disable PCH with sccache by default. * Add a base PCH to LLVMSupport, which includes widely used standard library and Support+ADT headers. The pch.h is placed in include so that later PCH headers can extend that list of headers. * Flang PCH use is ported to the general mechanism. Addition of PCH headers for other components (e.g., IR, CodeGen) will be posted as separate PRs. RFC: https://discourse.llvm.org/t/rfc-use-pre-compiled-headers-to-speed-up-llvm-build-by-1-5-2x/89345
Polly - Polyhedral optimizations for LLVM ----------------------------------------- http://polly.llvm.org/ Polly uses a mathematical representation, the polyhedral model, to represent and transform loops and other control flow structures. Using an abstract representation it is possible to reason about transformations in a more general way and to use highly optimized linear programming libraries to figure out the optimal loop structure. These transformations can be used to do constant propagation through arrays, remove dead loop iterations, optimize loops for cache locality, optimize arrays, apply advanced automatic parallelization, drive vectorization, or they can be used to do software pipelining.