aboutsummaryrefslogtreecommitdiff
path: root/test/inline.go
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2023-08-11 09:40:31 -0400
committerThan McIntosh <thanm@google.com>2023-09-14 19:43:26 +0000
commit0b07bbd2be98f80f3d447a266803f1d68aee2902 (patch)
tree92297f27acc5d3a0b6bcdb1ae997bd2ebc1a9639 /test/inline.go
parent7d0b611dbee183ada5e16be9884b90c3cf64fe3f (diff)
downloadgo-0b07bbd2be98f80f3d447a266803f1d68aee2902.tar.gz
go-0b07bbd2be98f80f3d447a266803f1d68aee2902.zip
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>
Diffstat (limited to 'test/inline.go')
-rw-r--r--test/inline.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/inline.go b/test/inline.go
index a2c13103d3..9bc0cf5e4b 100644
--- a/test/inline.go
+++ b/test/inline.go
@@ -1,5 +1,8 @@
// errorcheckwithauto -0 -m -d=inlfuncswithclosures=1
+//go:build !goexperiment.newinliner
+// +build !goexperiment.newinliner
+
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.