From 2ba9975a75f46e5a1d1e799dd7dc7b7de4b4ac12 Mon Sep 17 00:00:00 2001 From: John Galt Date: Tue, 14 May 2024 10:38:12 -0400 Subject: [PATCH] cc/lto: add property for not restricting instr limit There are cases where the 40 instr limit harms performance, thus far seen with libbinder and app launch times. The minimal increase in memory usage is a worthy trade off in this case. Signed-off-by: Pranav Vashi --- cc/lto.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cc/lto.go b/cc/lto.go index 08ce3b1524..35da62da20 100644 --- a/cc/lto.go +++ b/cc/lto.go @@ -54,6 +54,8 @@ type LTOProperties struct { // Use -fwhole-program-vtables cflag. Whole_program_vtables *bool + + Lto_Instr100 *bool } type lto struct { @@ -142,7 +144,7 @@ func (lto *lto) flags(ctx ModuleContext, flags Flags) Flags { // Reduce the inlining threshold for a better balance of binary size and // performance. - if !ctx.Darwin() { + if !ctx.Darwin() && !Bool(lto.Properties.Lto_Instr100) { if ctx.isAfdoCompile(ctx) || lto.ThinLTO() { ltoLdFlags = append(ltoLdFlags, "-Wl,-plugin-opt,-import-instr-limit=40") } else {