]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: use edge weights to decide inlineability in PGO
authorCherry Mui <cherryyz@google.com>
Tue, 1 Nov 2022 15:40:29 +0000 (11:40 -0400)
committerCherry Mui <cherryyz@google.com>
Wed, 2 Nov 2022 21:06:46 +0000 (21:06 +0000)
commitfb4f7fdb26da9ed0fee6beab280c84b399edaa42
tree3a57051b41e9daf1325fc95f7c9700113b06db94
parenta5b4283dfd90687d4263b38001e06bd3acf8b752
cmd/compile: use edge weights to decide inlineability in PGO

Currently, with PGO, the inliner uses node weights to decide if a
function is inlineable (with a larger budget). But the actual
inlining is determined by the weight of the call edge. There is a
discrepancy that, if a callee node is hot but the call edge is not,
it would not inlined, and marking the callee inlineable would of
no use.

Instead of using two kinds of weights, we just use the edge
weights to decide inlineability. If a function is the callee of a
hot call edge, its inlineability is determined with a larger
threshold. For a function that exceeds the regular inlining budget,
it is still inlined only when the call edge is hot, as it would
exceed the regular inlining cost for non-hot call sites, even if
it is marked inlineable.

For #55022.

Change-Id: I93fa9919fc6bcbb394e6cfe54ec96a96eede08f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/447015
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/compile/internal/base/debug.go
src/cmd/compile/internal/inline/inl.go
src/cmd/compile/internal/pgo/irgraph.go