]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile/internal/inl: inline based on scoring when GOEXPERIMENT=newinliner
authorThan McIntosh <thanm@google.com>
Fri, 11 Aug 2023 13:40:31 +0000 (09:40 -0400)
committerThan McIntosh <thanm@google.com>
Thu, 14 Sep 2023 19:43:26 +0000 (19:43 +0000)
commit0b07bbd2be98f80f3d447a266803f1d68aee2902
tree92297f27acc5d3a0b6bcdb1ae997bd2ebc1a9639
parent7d0b611dbee183ada5e16be9884b90c3cf64fe3f
cmd/compile/internal/inl: inline based on scoring when GOEXPERIMENT=newinliner

This patch changes the inliner to use callsite scores when deciding to
inline as opposed to looking only at callee cost/hairyness.

For this to work, we have to relax the inline budget cutoff as part of
CanInline to allow for the possibility that a given function might
start off with a cost of N where N > 80, but then be called from a
callsites whose score is less than 80. Once a given function F in
package P has been approved by CanInline (based on the relaxed budget)
it will then be emitted as part of the export data, meaning that other
packages importing P will need to also need to compute callsite scores
appropriately.

For a function F that calls function G, if G is marked as potentially
inlinable then the hairyness computation for F will use G's cost for
the call to G as opposed to the default call cost; for this to work
with the new scheme (given relaxed cost change described above) we
use G's cost only if it falls below inlineExtraCallCost, otherwise
just use inlineExtraCallCost.

Included in this patch are a bunch of skips and workarounds to
selected 'errorcheck' tests in the <GOROOT>/test directory to deal
with the additional "can inline" messages emitted when the new inliner
is turned on.

Change-Id: I9be5f8cd0cd8676beb4296faf80d2f6be7246335
Reviewed-on: https://go-review.googlesource.com/c/go/+/519197
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/inline/inl.go
src/cmd/compile/internal/inline/inlheur/callsite.go
test/closure3.go
test/escape4.go
test/fixedbugs/issue19261.go
test/fixedbugs/issue4099.go
test/fixedbugs/issue42284.go
test/fixedbugs/issue7921.go
test/inline.go
test/newinline.go [new file with mode: 0644]