Author: Nico Weber Date: 2020-02-20T08:50:54+01:00 New Revision: f004359106cfda578733dff1380560b68f9c3713
URL: https://github.com/llvm/llvm-project/commit/f004359106cfda578733dff1380560b68f9c3713 DIFF: https://github.com/llvm/llvm-project/commit/f004359106cfda578733dff1380560b68f9c3713.diff LOG: [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 (cherry picked from commit 09153ab9d267a86d6e9bce18d5074617de5879a5) Added: Modified: llvm/cmake/modules/HandleLLVMOptions.cmake llvm/utils/gn/build/BUILD.gn Removed: ################################################################################ diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index ab219e52f9d9..30f04ca34c2c 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -788,6 +788,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) diff --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn index b06ef9ad83e3..b74268996f15 100644 --- a/llvm/utils/gn/build/BUILD.gn +++ b/llvm/utils/gn/build/BUILD.gn @@ -60,6 +60,7 @@ config("compiler_defaults") { if (is_optimized) { cflags += [ "/O2", + "/Gw", "/Zc:inline", ] ldflags += [ _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits