[PATCH] D74573: [windows] Add /Gw to compiler flags
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 13 11:47:03 PST 2020
thakis created this revision.
thakis added a reviewer: rnk.
Herald added a subscriber: mgorny.
Herald added a project: LLVM.
This is like -fdata-sections, and it's not part of /O2 <https://reviews.llvm.org/owners/package/2/> 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.
https://reviews.llvm.org/D74573
Files:
llvm/cmake/modules/HandleLLVMOptions.cmake
llvm/utils/gn/build/BUILD.gn
Index: llvm/utils/gn/build/BUILD.gn
===================================================================
--- llvm/utils/gn/build/BUILD.gn
+++ llvm/utils/gn/build/BUILD.gn
@@ -59,8 +59,8 @@
}
if (is_optimized) {
cflags += [
- # FIXME: evaluate /Gw (not part of /O2)
"/O2",
+ "/Gw",
"/Zc:inline",
]
ldflags += [
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -793,6 +793,10 @@
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74573.244491.patch
Type: text/x-patch
Size: 842 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200213/adb632c4/attachment.bin>
More information about the llvm-commits
mailing list