[windows] Add /Gw to compiler flags

This is like -fdata-sections, and it's not part of /O2 by default for some reason.

In the cmake build, reduces the size of clang.exe from 70,358,016 bytes to 69,982,720 bytes.

clang-format.exe goes from 3,703,296 bytes to 3,331,072 bytes.

Differential Revision: https://reviews.llvm.org/D74573
This commit is contained in:
Nico Weber 2020-02-14 15:15:00 -05:00
parent 65d3ccce3d
commit eeff3458f0
2 changed files with 5 additions and 1 deletions

View File

@ -793,6 +793,10 @@ if(NOT CYGWIN AND NOT WIN32)
endif()
add_flag_if_supported("-fdata-sections" FDATA_SECTIONS)
endif()
elseif(MSVC)
if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
append("/Gw" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
endif()
if(MSVC)

View File

@ -59,8 +59,8 @@ config("compiler_defaults") {
}
if (is_optimized) {
cflags += [
# FIXME: evaluate /Gw (not part of /O2)
"/O2",
"/Gw",
"/Zc:inline",
]
ldflags += [