[libc++] Don't force -O2 when building the benchmarks
authorLouis Dionne <ldionne.2@gmail.com>
Thu, 16 Jun 2022 17:39:01 +0000 (13:39 -0400)
committerLouis Dionne <ldionne.2@gmail.com>
Fri, 17 Jun 2022 21:34:02 +0000 (17:34 -0400)
The optimization level used when building the benchmarks should
match the optimization level of the current build. Otherwise, we
can end up mixing an -O3 or -O0 optimized dylib with benchmarks
built with -O2, which is really misleading.

Differential Revision: https://reviews.llvm.org/D127987

libcxx/benchmarks/CMakeLists.txt

index bc5052d..8a9c1a2 100644 (file)
@@ -82,7 +82,7 @@ set(BENCHMARK_NATIVE_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-native)
 
 add_library(               cxx-benchmarks-flags INTERFACE)
 target_compile_features(   cxx-benchmarks-flags INTERFACE cxx_std_20)
-target_compile_options(    cxx-benchmarks-flags INTERFACE -O2 -fsized-deallocation -nostdinc++)
+target_compile_options(    cxx-benchmarks-flags INTERFACE -fsized-deallocation -nostdinc++)
 target_include_directories(cxx-benchmarks-flags INTERFACE "${LIBCXX_GENERATED_INCLUDE_DIR}"
                                                 INTERFACE "${BENCHMARK_LIBCXX_INSTALL}/include"
                                                 INTERFACE "${LIBCXX_SOURCE_DIR}/test/support")