[clang] Workaround for MSVC ARM64 build performance regression (PR #65215)

Tobias Hieta via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 3 23:36:45 PDT 2023


================
@@ -30,6 +30,15 @@ set(LLVM_LINK_COMPONENTS
   TransformUtils
   )
 
+# Workaround for MSVC ARM64 performance regression: disable all optimizations (/Od)
+# and then enable back all /O2 options except one.
+if(NOT CMAKE_BUILD_TYPE MATCHES Debug 
+    AND MSVC 
+    AND MSVC_VERSION VERSION_GREATER_EQUAL 1932
+    AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64")
+  set_source_files_properties(CGBuiltin.cpp PROPERTIES COMPILE_FLAGS "/Od /Gw /Oi /Oy /Gy /Ob2 /Ot /GF")
----------------
tru wrote:

Yeah I think this is what we want. We don't want to assume what the current flags are. Does it only happen in Release and RelWithDebInfo configurations? In that case you can maybe use generator expressions to only happen for those configurations?

Btw I noticed that COMPILE_FLAGS is deprecated and COMPILE_OPTIONS should be used instead, so maybe look into that as well?

https://github.com/llvm/llvm-project/pull/65215


More information about the cfe-commits mailing list