]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: don't inline hot calls into big functions
authorMichael Pratt <mpratt@google.com>
Tue, 28 Mar 2023 16:45:17 +0000 (12:45 -0400)
committerMichael Pratt <mpratt@google.com>
Mon, 10 Apr 2023 21:06:54 +0000 (21:06 +0000)
commitc1ac63e9732a54ef8349fe0bdbb3fa47bd0847c2
tree371dd9bf1bee7ae6849c7f0b555be79b2cf9e698
parenta5c79283f79b5f03296fc2037f32d935aaec806f
cmd/compile: don't inline hot calls into big functions

Standard inlining has a reduced maximum cost of callees (20 instead of
80) when inlining into a "big" function, to limit how much bigger we
will make an already big function.

When adding PGO hot call budget increases, we inadvertently bypassed
this "big" function restriction, allowing hot calls of up to
inlineHotMaxBudget, even into big functions.

Add the restriction back, even for hot calls. If a function is already
very large, we probably shouldn't inline even more.

A very important note here is that function "big"-ness is computed prior
to any inlining. One potential problem with PGO is that many hot calls
inline into an initially-small function and ultimately make it very
large. This CL does nothing to address that case, which would require
recomputing size after inlining.

This CL has no impact on sweet PGO benchmarks. I specifically dug into
tile38, which contained 0 hot big functions. Other benchmarks are
probably similar.

Change-Id: I3b6304eaf7738a219359d4b8bb121d68babfea8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/482157
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
src/cmd/compile/internal/inline/inl.go