Merge "Tweak ThinLTO inling heuristics in absense of PGO profile" am: 76a5ba81e2 am: 280fdb9610 am: 5499f46ea6

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1433954

Change-Id: If62040ff341ee2856217978a2fd636dc98f4a66d
This commit is contained in:
Yi Kong
2020-09-23 05:49:07 +00:00
committed by Automerger Merge Worker

View File

@@ -117,12 +117,11 @@ func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags {
flags.Local.LdFlags = append(flags.Local.LdFlags, cachePolicyFormat+policy) flags.Local.LdFlags = append(flags.Local.LdFlags, cachePolicyFormat+policy)
} }
// If the module does not have a profile, be conservative and do not inline // If the module does not have a profile, be conservative and limit cross TU inline
// or unroll loops during LTO, in order to prevent significant size bloat. // limit to 5 LLVM IR instructions, to balance binary size increase and performance.
if !ctx.isPgoCompile() { if !ctx.isPgoCompile() {
flags.Local.LdFlags = append(flags.Local.LdFlags, flags.Local.LdFlags = append(flags.Local.LdFlags,
"-Wl,-plugin-opt,-inline-threshold=0", "-Wl,-plugin-opt,-import-instr-limit=5")
"-Wl,-plugin-opt,-unroll-threshold=0")
} }
} }
return flags return flags