perf: build zm_zone.cpp with gcc's dynamic vector cost model so motion detection vectorizes at -O2, fixes #5482

This commit is contained in:
Jash committed 2026-11-08 15:37:41 +05:30
1 parent 8556830515
commit ff052d5c68
1 file changed
+6
+6
View File
@@ -143,6 +143,12 @@ if(GSOAP_FOUND)
endif()
# GCC 12+ only vectorizes with its very-cheap cost model at -O2, which leaves the
# per-pixel motion detection loop in zm_zone.cpp scalar in Release builds.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set_source_files_properties(zm_zone.cpp PROPERTIES COMPILE_OPTIONS "-fvect-cost-model=dynamic")
endif()
# A fix for cmake recompiling the source files for every target.
add_library(zm STATIC ${ZM_BIN_SRC_FILES})