From d59fb4b25e8385abbe20117c0a453cdc2e850f36 Mon Sep 17 00:00:00 2001 From: Joey Riches Date: Thu, 10 Oct 2024 12:30:08 +0100 Subject: [PATCH 1/2] boulder/data: Ensure split-machine-functions are disabled in bolt flags split-machine-functions is an optional flag for PGO optimize builds that uses the profile data to split hot/cold/unlikely .text sections. Although disabled by default, BOLT does it's own version of splitting hot/cold .text which split-machine-functions gets in the way of. --- boulder/data/macros/arch/base.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boulder/data/macros/arch/base.yaml b/boulder/data/macros/arch/base.yaml index d13e3a26..076767a8 100644 --- a/boulder/data/macros/arch/base.yaml +++ b/boulder/data/macros/arch/base.yaml @@ -449,6 +449,8 @@ flags : cxx : "-fno-reorder-blocks-and-partition​" ld : "-Wl,-q" llvm: + c : "-fno-split-machine-functions" + cxx : "-fno-split-machine-functions" ld : "-Wl,-q" # Toggle -fcommon (OFF) From eaae5014c04040d31027ddf4033fa8c4086472b5 Mon Sep 17 00:00:00 2001 From: Joey Riches Date: Thu, 10 Oct 2024 15:47:58 +0100 Subject: [PATCH 2/2] boulder/data: Update BOLT optimization options - Do not use deprecated options - Enable PLT optimizations - Enable peephole optimizations - Change split-stragegy to cdsplit - Update debug functions now DWARF5 is well supported --- boulder/data/macros/actions/pgo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boulder/data/macros/actions/pgo.yaml b/boulder/data/macros/actions/pgo.yaml index 769ccf05..8a113280 100644 --- a/boulder/data/macros/actions/pgo.yaml +++ b/boulder/data/macros/actions/pgo.yaml @@ -37,7 +37,7 @@ actions: description: Apply bolt profile command: | boptim(){ - llvm-bolt ${1}.orig -o ${1}.bolt -data=%(pgo_dir)/$(basename ${1}).fdata -reorder-blocks=cache+ -reorder-functions=hfsort+ -split-functions=3 -split-all-cold -split-eh -dyno-stats -icf=1 -use-gnu-stack ${2} ${3} ${4} + llvm-bolt ${1}.orig -o ${1}.bolt -data=%(pgo_dir)/$(basename ${1}).fdata -reorder-blocks=ext-tsp -reorder-functions=hfsort+ -split-functions -split-strategy=cdsplit -plt=all -peepholes=all -split-eh -dyno-stats -icf=1 -use-gnu-stack -use-old-text -update-debug-sections ${2} ${3} ${4} cp ${1}.bolt ${1} } boptim