mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-25 11:00:35 +00:00
In90a6c3bd7a("build: reduce release mode inline tuning on aarch64") we reduced inlining on aarch64, due to miscompiles. In224a2877b9("build: disable -Og in debug mode to avoid coroutine asan breakage") we disabled optimization in debug mode, due to miscompiles. With clang 18.1, it appears the miscompiles are gone, and we can remove the two workarounds. Closes scylladb/scylladb#19531
34 lines
1.4 KiB
CMake
34 lines
1.4 KiB
CMake
# it's important to *set* CMAKE_CXX_FLAGS_RELWITHDEBINFO here. otherwise,
|
|
# CMAKE_CXX_FLAGS_RELWITHDEBINFO would be initialized with
|
|
# CMAKE_CXX_FLAGS_RELWITHDEBUGINF_INIT, which is "-O2 -g -DNDEBUG",
|
|
# in CMake 3.27, but we need to enable "assert()" even with the release
|
|
# builds. so let's set this flagset instead of appending to it.
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
|
"-ffunction-sections -fdata-sections"
|
|
CACHE
|
|
INTERNAL
|
|
"")
|
|
update_cxx_flags(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
|
WITH_DEBUG_INFO
|
|
OPTIMIZATION_LEVEL "3")
|
|
|
|
set(scylla_build_mode_RelWithDebInfo "release")
|
|
add_compile_definitions(
|
|
$<$<CONFIG:RelWithDebInfo>:SCYLLA_BUILD_MODE=${scylla_build_mode_RelWithDebInfo}>)
|
|
|
|
set(clang_inline_threshold 2500)
|
|
add_compile_options(
|
|
"$<$<AND:$<CONFIG:RelWithDebInfo>,$<CXX_COMPILER_ID:GNU>>:--param;inline-unit-growth=300>"
|
|
"$<$<AND:$<CONFIG:RelWithDebInfo>,$<CXX_COMPILER_ID:Clang>>:-mllvm;-inline-threshold=${clang_inline_threshold}>")
|
|
# clang generates 16-byte loads that break store-to-load forwarding
|
|
# gcc also has some trouble: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103554
|
|
check_cxx_compiler_flag("-fno-slp-vectorize" _slp_vectorize_supported)
|
|
if(_slp_vectorize_supported)
|
|
add_compile_options(
|
|
$<$<CONFIG:RelWithDebInfo>:-fno-slp-vectorize>)
|
|
endif()
|
|
|
|
add_link_options($<$<CONFIG:RelWithDebInfo>:LINKER:--gc-sections>)
|
|
|
|
maybe_limit_stack_usage_in_KB(13 RelWithDebInfo)
|