cmd/compile: write "properties" to export data for inlinable funcs

Augment the ir.Inline container to include an entry for function
properties (currently serialized as a string), and if
GOEXPERIMENT=newinliner is set, compute and store function
properties for all inline candidates processed by the inliner.

The idea here is that if the function properties are going to drive
inlining decisions, we'd like to have the same info from non-local /
imported functions as for local / in-package functions, hence we need
to include the properties in the export data.

Hand testing on the compiler itself and with k8s kubelet shows that
this increases the size of export data overall by about 2-3 percent,
so a pretty modest increase.

Updates #61502.

Change-Id: I9d1c311aa8418d02ffea3629c3dd9d8076886d15
Reviewed-on: https://go-review.googlesource.com/c/go/+/511562
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Than McIntosh 2023-06-29 13:22:26 -04:00
parent 906a073b0b
commit 323cf73091
5 changed files with 54 additions and 13 deletions

View file

@ -200,6 +200,10 @@ type Inline struct {
Dcl []*Name
HaveDcl bool // whether we've loaded Dcl
// Function properties, encoded as a string (these are used for
// making inlining decisions). See cmd/compile/internal/inline/inlheur.
Properties string
// CanDelayResults reports whether it's safe for the inliner to delay
// initializing the result parameters until immediately before the
// "return" statement.