Skip to content

Commit

Permalink
cc/lto: add property for not restricting instr limit
Browse files Browse the repository at this point in the history
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 <neobuddy89@gmail.com>
  • Loading branch information
RealJohnGalt authored and neobuddy89 committed Sep 8, 2024
1 parent ae712c4 commit 2ba9975
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cc/lto.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ type LTOProperties struct {

// Use -fwhole-program-vtables cflag.
Whole_program_vtables *bool

Lto_Instr100 *bool
}

type lto struct {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 2ba9975

Please sign in to comment.