diff options
| author | Reid Kleckner <rnk@google.com> | 2018-02-15 21:25:23 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2018-02-15 21:25:23 +0000 |
| commit | b97ff922a9eeea6efbf12deba907848e5002cc76 (patch) | |
| tree | 4980f12d5f5f846de6c9c4126be86dc4bfb70f9b /llvm/cmake/modules | |
| parent | de9ad4ba848729f0826131a947fdbaae98df6d05 (diff) | |
| download | bcm5719-llvm-b97ff922a9eeea6efbf12deba907848e5002cc76.tar.gz bcm5719-llvm-b97ff922a9eeea6efbf12deba907848e5002cc76.zip | |
Don't make PDBs by default in Release mode
Introduce the LLVM_ENABLE_PDB option so that users can request them
explicitly instead.
Add /OPT:REF and /OPT:ICF back, which /DEBUG disables by default.
Differential Revision: https://reviews.llvm.org/D43156
llvm-svn: 325296
Diffstat (limited to 'llvm/cmake/modules')
| -rw-r--r-- | llvm/cmake/modules/HandleLLVMOptions.cmake | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index 51d266cdc7c..2dc5690355c 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -353,11 +353,18 @@ if( MSVC ) append("/Zc:inline" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) - # Generate PDB even in release for profiling. - if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE") + # Allow users to request PDBs in release mode. CMake offeres the + # RelWithDebInfo configuration, but it uses different optimization settings + # (/Ob1 vs /Ob2 or -O2 vs -O3). LLVM provides this flag so that users can get + # PDBs without changing codegen. + option(LLVM_ENABLE_PDB OFF) + if (LLVM_ENABLE_PDB AND uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE") append("/Zi" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) - append("/DEBUG" CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS) - endif (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE") + # /DEBUG disables linker GC and ICF, but we want those in Release mode. + append("/DEBUG /OPT:REF /OPT:ICF" + CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS + CMAKE_SHARED_LINKER_FLAGS) + endif() # /Zc:strictStrings is incompatible with VS12's (Visual Studio 2013's) # debug mode headers. Instead of only enabling them in VS2013's debug mode, |

