kou commented on code in PR #15022:
URL: https://github.com/apache/arrow/pull/15022#discussion_r1104013175


##########
cpp/cmake_modules/SetupCxxFlags.cmake:
##########
@@ -604,76 +604,42 @@ endif()
 # For all builds:
 # For CMAKE_BUILD_TYPE=Debug
 #   -ggdb: Enable gdb debugging
-# For CMAKE_BUILD_TYPE=FastDebug
-#   Same as Debug, except with some optimizations on.
 # For CMAKE_BUILD_TYPE=Release
-#   -O2: Enable all compiler optimizations
+#   -O2 (not -O3): Enable compiler optimizations
 #   Debug symbols are stripped for reduced binary size.
 # For CMAKE_BUILD_TYPE=RelWithDebInfo
 #   Same as Release, except with debug symbols enabled.
 
 if(NOT MSVC)
-  string(REPLACE "-O3" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
-  string(REPLACE "-O3" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO
-                 "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
-
-  set(RELEASE_FLAGS "-O2 -DNDEBUG")
+  set(C_RELEASE_FLAGS "")
+  if(CMAKE_C_FLAGS_RELEASE MATCHES "-O3")
+    string(APPEND C_RELEASE_FLAGS " -O2")

Review Comment:
   Yes.
   We don't have any benefit with `-O3`.
   See also: #32703 and #13661
   
   > -O3 can produce longer build times and larger binaries for next to no 
performance benefits.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to