From 10c3cf9a47f928075563abd89c01b5de9f24e807 Mon Sep 17 00:00:00 2001 From: Daniel Bertalan Date: Tue, 21 Sep 2021 22:59:03 +0200 Subject: [PATCH] Kernel: Enable LTO for kernel_heap if `ENABLE_KERNEL_LTO` is set By enabling LTO for the kernel_heap object too, we open the door for optimization opportunities that come from (partially) inlining `::new` or kmalloc. Every software spends a non-trivial amount of its run time on allocating memory, so hopefully this change will make LTO builds even faster. --- Kernel/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index 4af539332f9..54684445339 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -496,6 +496,9 @@ if (ENABLE_KERNEL_LTO) check_ipo_supported() add_definitions(-DENABLE_KERNEL_LTO) set_property(TARGET Kernel PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) + if (NOT "${SERENITY_ARCH}" STREQUAL "aarch64") + set_property(TARGET kernel_heap PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) + endif() endif() if (NOT "${SERENITY_ARCH}" STREQUAL "aarch64")