From 4ebb694e4b694af13f4af2ebef4d3c06bd6949ed Mon Sep 17 00:00:00 2001 From: blyxyas Date: Sat, 2 Mar 2024 16:39:15 +0100 Subject: [PATCH 1/2] Add more optimizations --- src/tools/opt-dist/src/bolt.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/tools/opt-dist/src/bolt.rs b/src/tools/opt-dist/src/bolt.rs index f694c08f9b937..03f73eb0c309b 100644 --- a/src/tools/opt-dist/src/bolt.rs +++ b/src/tools/opt-dist/src/bolt.rs @@ -66,11 +66,18 @@ pub fn bolt_optimize(path: &Utf8Path, profile: &BoltProfile) -> anyhow::Result<( // Split function code into hot and code regions .arg("-split-functions") // Split as many basic blocks as possible - .arg("-split-all-cold") - // Move jump tables to a separate section .arg("-jump-tables=move") // Fold functions with identical code .arg("-icf=1") + // Perform indirect call promotion on calls and jump tables + .arg("-indirect-call-promotion=all") + // Optimize stack frame accesses + .arg("-frame-opt=hot") + // Inline functions smaller than 32 bytes + .arg("-inline-small-functions") + .arg("-inline-small-functions-bytes=32") + // Perform peephole optimizations + .arg("-peepholes=all") // The following flag saves about 50 MiB of libLLVM.so size. // However, it succeeds very non-deterministically. To avoid frequent artifact size swings, // it is kept disabled for now. From e67a236e896ceb361346d4d49a1ae9950b33d5a5 Mon Sep 17 00:00:00 2001 From: blyxyas Date: Mon, 4 Mar 2024 14:18:08 +0100 Subject: [PATCH 2/2] Restore `-split-all-cold` and remove peepholes based on feedback --- src/tools/opt-dist/src/bolt.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/opt-dist/src/bolt.rs b/src/tools/opt-dist/src/bolt.rs index 03f73eb0c309b..abc1763f3c2f7 100644 --- a/src/tools/opt-dist/src/bolt.rs +++ b/src/tools/opt-dist/src/bolt.rs @@ -66,6 +66,8 @@ pub fn bolt_optimize(path: &Utf8Path, profile: &BoltProfile) -> anyhow::Result<( // Split function code into hot and code regions .arg("-split-functions") // Split as many basic blocks as possible + .arg("-split-all-cold") + // Move jump tables to a separate section .arg("-jump-tables=move") // Fold functions with identical code .arg("-icf=1") @@ -76,8 +78,6 @@ pub fn bolt_optimize(path: &Utf8Path, profile: &BoltProfile) -> anyhow::Result<( // Inline functions smaller than 32 bytes .arg("-inline-small-functions") .arg("-inline-small-functions-bytes=32") - // Perform peephole optimizations - .arg("-peepholes=all") // The following flag saves about 50 MiB of libLLVM.so size. // However, it succeeds very non-deterministically. To avoid frequent artifact size swings, // it is kept disabled for now.