Skip to content

Commit a3b925b

Browse files
bernhardmgruberamadio
authored andcommitted
conditionally disable SSAOptimizer for VS2019
1 parent 88d57c9 commit a3b925b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ elseif(MSVC_VERSION LESS 1900)
6666
message(FATAL_ERROR "Vc 1.x requires at least Visual Studio 2015.")
6767
endif()
6868

69+
if(MSVC AND (NOT DEFINED Vc_USE_MSVC_SSA_OPTIMIZER_DESPITE_BUGGY_EXP OR NOT Vc_USE_MSVC_SSA_OPTIMIZER_DESPITE_BUGGY_EXP) AND
70+
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.20)
71+
# bug report: https://developercommunity.visualstudio.com/t/AVX-codegen-bug-on-Vc-with-MSVC-2019/1470844#T-N1521672
72+
message(STATUS "WARNING! MSVC starting with 19.20 uses a new optimizer that has a bug causing Vc::exp() to return slighly wrong results.\
73+
You can set Vc_USE_MSVC_SSA_OPTIMIZER_DESPITE_BUGGY_EXP=ON to still use the new optimizer on the affected MSVC versions.")
74+
AddCompilerFlag("/d2SSAOptimizer-" CXX_RESULT _ok CXX_FLAGS CMAKE_CXX_FLAGS)
75+
endif()
76+
6977
if(Vc_COMPILER_IS_GCC)
7078
if(Vc_GCC_VERSION VERSION_GREATER "5.0.0" AND Vc_GCC_VERSION VERSION_LESS "6.0.0")
7179
UserWarning("GCC 5 goes into an endless loop comiling example_scaling_scalar. Therefore, this target is disabled.")

0 commit comments

Comments
 (0)