Merge "Limit LTO inlining even when profile is present" into main am: 3ff50d5854
am: 0e0b43a5ee
am: 57655e5e87
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2684608 Change-Id: Ifd158bc5f1d87f3f6c6c27eeb0a284668042a8a0 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
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)
|
ltoLdFlags = append(ltoLdFlags, cachePolicyFormat+policy)
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the module does not have a profile, be conservative and limit cross TU inline
|
// Reduce the inlining threshold for a better balance of binary size and
|
||||||
// limit to 5 LLVM IR instructions, to balance binary size increase and performance.
|
// performance.
|
||||||
if !ctx.Darwin() && !ctx.isPgoCompile() && !ctx.isAfdoCompile() {
|
if !ctx.Darwin() {
|
||||||
ltoLdFlags = append(ltoLdFlags, "-Wl,-plugin-opt,-import-instr-limit=5")
|
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...)
|
flags.Local.CFlags = append(flags.Local.CFlags, ltoCFlags...)
|
||||||
|
Reference in New Issue
Block a user