- Disables incremental linking by default. /INCREMENTAL adds extra thunks in the EXE, which makes execution slower.
- Sets /MT (static CRT lib) by default instead of CMake's default /MD (dll CRT lib). The previous default /MD makes all DLL functions to be thunked, thus making execution slower (memcmp, memset, etc.)
- Adds LLVM_ENABLE_INCREMENTAL_LINK which is set to OFF by default.
I thought it'd be better if Clang / LLVM / LLD would be fast out-of-the-box, instead of people having to dig for "good" settings.
Below are timings for linking a large DLL with LLD. The type merging pass is dominant, and is affected by those two options, because of the tight merge loop. I currently have several optimisations in that loop that tend to increase the gap.
Without this patch (default cmake settings):
Type Merging: 23174 ms ( 56.9%)
With this patch (new default cmake settings):
Type Merging: 22338 ms ( 52.2%)
This is a MSVC-only change. Tested with VS2017 15.9.1 (MSVC 19.16.27023.1 x64)