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) 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 += [