]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/pgo: remove ListOfHotCallSites
authorMichael Pratt <mpratt@google.com>
Mon, 31 Oct 2022 16:20:09 +0000 (12:20 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 1 Nov 2022 22:13:50 +0000 (22:13 +0000)
commitd73885588ac0a7520ac3e848112e44f5dbe97006
tree52e6a715c28f5f0fcf7d70da27fcd08f3d5fbb18
parent1ae93e4c201af78b000dccef0c2489bf7fb879ca
cmd/compile/internal/pgo: remove ListOfHotCallSites

The global ListOfHotCallSites set is used to communicate between
CanInline and InlineCalls the set of call sites that InlineCalls may
increase the budget for.

CanInline clears this map on each call, thus assuming that
InlineCalls(x) is called immediately after CanInline(x). This assumption
is false, as CanInline (among other cases) is recursive (CanInline ->
hairyVisitor.doNode -> inlCallee -> CanInline).

When this assumption proves false, we will lose the opportunity to
inline hot calls.

This CL is the least invasive fix for this. ListOfHotCallSites is
actually just a subset of the candHotEdgeMap, with CallSiteInfo.Callee
cleared. candHotEdgeMap doesn't actually need to distinguish based on
Callee, so we can drop callee from candHotEdgeMap as well and just use
that directly [1].

Later CLs should do more work to remove the globals entirely.

For cmd/compile, this inceases the number of PGO inlined functions by
~50% for one set of PGO parameters. I have no evaluated performance
impact.

[1] This is something that we likely want to change in the future.

For #55022.

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