From 44ac1fd5c8dc093c4f38539cbfb41d225179c13a Mon Sep 17 00:00:00 2001 From: RubenKelevra Date: Fri, 13 May 2022 22:54:38 +0200 Subject: [PATCH] enable live range shrinkage to relief register pressure docs: I'd recommend to use this at least for x86/x86-64. I think any OOO processor with small or moderate register file which does not use the 1st insn scheduling might benefit from this too. On SPEC2000 for x86/x86-64 (I use Haswell processor, -O3 with general tuning), the optimization usage results in smaller code size in average (for floating point and integer benchmarks in 32- and 64-bit mode). The improvement better visible for SPECFP2000 (although I have the same improvement on x86-64 SPECInt2000 but it might be attributed mostly mcf benchmark unstability). It is about 0.5% for 32-bit and 64-bit mode. It is understandable, as the optimization has more opportunities to improve the code on longer BBs. Different from other heuristic optimizations, I don't see any significant worse performance. It gives practically the same or better performance (a few benchmarks imporoved by 1% or more upto 3%). The single but significant drawback is additional compilation time (4%-6%) as the 1st insn scheduling pass is quite expensive. Source of docs: https://gcc.gnu.org/legacy-ml/gcc-patches/2013-11/msg00420.html --- utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.go b/utils.go index ff5399b..6243700 100644 --- a/utils.go +++ b/utils.go @@ -727,7 +727,7 @@ func setupMakepkg(march string) error { } makepkgStr = strings.ReplaceAll(makepkgStr, " color ", " !color ") // Add align-functions=32, see https://github.com/InBetweenNames/gentooLTO/issues/164 for more - makepkgStr = strings.ReplaceAll(makepkgStr, "-O2", "-O3 -falign-functions=32 -mpclmul -fdevirtualize-at-ltrans -fgcse-sm -fgcse-las") + makepkgStr = strings.ReplaceAll(makepkgStr, "-O2", "-O3 -falign-functions=32 -mpclmul -fdevirtualize-at-ltrans -fgcse-sm -fgcse-las -flive-range-shrinkage") makepkgStr = strings.ReplaceAll(makepkgStr, "#MAKEFLAGS=\"-j2\"", "MAKEFLAGS=\"-j"+strconv.Itoa(conf.Build.Makej)+"\"") makepkgStr = reMarch.ReplaceAllString(makepkgStr, "${1}"+march) makepkgStr = strings.ReplaceAll(makepkgStr, "#PACKAGER=\"John Doe \"", "PACKAGER=\"ALHP "+march+" \"")