Limit LTO inlining even when profile is present
Reduce the import instr limit from the LLVM default (100) to 40. This helps reduce the binary size as well as improving performance slightly. Size: Default(100) 40 30 libhwui.so 11059040 11058912 11060872 libart.so 10697576 10697160 10696568 Performance: 40 vs. default: 0.37% improvement http://go/art-benchmark?p=BootImageProfileId:36054 30 vs. default: 0.36% improvement http://go/art-benchmark?p=BootImageProfileId:36058 Test: presubmit Change-Id: Id800ff7818cde908daab784bac0a312c6a71272d
This commit is contained in:
parent
1e079dfdf2
commit
d6ab48c660
1 changed files with 8 additions and 4 deletions
12
cc/lto.go
12
cc/lto.go
|
@ -135,10 +135,14 @@ func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags {
|
|||
ltoLdFlags = append(ltoLdFlags, cachePolicyFormat+policy)
|
||||
}
|
||||
|
||||
// If the module does not have a profile, be conservative and limit cross TU inline
|
||||
// limit to 5 LLVM IR instructions, to balance binary size increase and performance.
|
||||
if !ctx.Darwin() && !ctx.isPgoCompile() && !ctx.isAfdoCompile() {
|
||||
ltoLdFlags = append(ltoLdFlags, "-Wl,-plugin-opt,-import-instr-limit=5")
|
||||
// Reduce the inlining threshold for a better balance of binary size and
|
||||
// performance.
|
||||
if !ctx.Darwin() {
|
||||
if ctx.isPgoCompile() || ctx.isAfdoCompile() {
|
||||
ltoLdFlags = append(ltoLdFlags, "-Wl,-plugin-opt,-import-instr-limit=40")
|
||||
} else {
|
||||
ltoLdFlags = append(ltoLdFlags, "-Wl,-plugin-opt,-import-instr-limit=5")
|
||||
}
|
||||
}
|
||||
|
||||
flags.Local.CFlags = append(flags.Local.CFlags, ltoCFlags...)
|
||||
|
|
Loading…
Reference in a new issue