From 63fa149329c3a5bbec603d69bed47b68f67c8774 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 3 Oct 2026 19:26:13 -0700 Subject: [PATCH 1/2] Enable link-time optimisation for release builds Release builds use link-time optimisation where the toolchain supports it (check_ipo_supported); elsewhere the build is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a330ef75..54093a363 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -227,6 +227,17 @@ endif() ################################################################ # Vampire ################################################################ +# link-time optimisation for release builds, if the toolchain supports it +if(CMAKE_BUILD_TYPE STREQUAL "Release") + include(CheckIPOSupported) + check_ipo_supported(RESULT IPO_SUPPORTED OUTPUT IPO_OUTPUT LANGUAGES CXX) + if(IPO_SUPPORTED) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) + else() + message(STATUS "link-time optimisation not supported: ${IPO_OUTPUT}") + endif() +endif() + # wrap up common object files so not built multiple times for each target add_library(common OBJECT ${SOURCES}) From d4f0632d33609bcc73787dc6fd5b987ecd097ebb Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 5 Oct 2026 12:52:44 -0700 Subject: [PATCH 2/2] Only print IPO check output when VERBOSE_IPO_FAILURE is set Co-Authored-By: Claude Opus 5.5 --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54093a363..ca3d0b29c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -234,7 +234,10 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release") if(IPO_SUPPORTED) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) else() - message(STATUS "link-time optimisation not supported: ${IPO_OUTPUT}") + message(STATUS "link-time optimisation not supported, building without it") + if(VERBOSE_IPO_FAILURE) + message(STATUS "${IPO_OUTPUT}") + endif() endif() endif()