aboutsummaryrefslogtreecommitdiff
path: root/test/fixedbugs
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/fixedbugs
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/fixedbugs')
-rw-r--r--test/fixedbugs/issue19261.go3
-rw-r--r--test/fixedbugs/issue4099.go5
-rw-r--r--test/fixedbugs/issue42284.go3
-rw-r--r--test/fixedbugs/issue7921.go3
4 files changed, 12 insertions, 2 deletions
diff --git a/test/fixedbugs/issue19261.go b/test/fixedbugs/issue19261.go
index 61cff6e1b0..8650982a4c 100644
--- a/test/fixedbugs/issue19261.go
+++ b/test/fixedbugs/issue19261.go
@@ -1,5 +1,8 @@
// errorcheckdir -0 -m
+//go:build !goexperiment.newinliner
+// +build !goexperiment.newinliner
+
// Copyright 2017 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.
diff --git a/test/fixedbugs/issue4099.go b/test/fixedbugs/issue4099.go
index 5a4ea7c998..7e9790ff68 100644
--- a/test/fixedbugs/issue4099.go
+++ b/test/fixedbugs/issue4099.go
@@ -1,5 +1,8 @@
// errorcheck -0 -m
+//go:build !goexperiment.newinliner
+// +build !goexperiment.newinliner
+
// Copyright 2013 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.
@@ -20,7 +23,7 @@ func F2([]byte)
func G() {
var buf1 [10]byte
F1(buf1[:])
-
+
var buf2 [10]byte // ERROR "moved to heap: buf2"
F2(buf2[:])
}
diff --git a/test/fixedbugs/issue42284.go b/test/fixedbugs/issue42284.go
index e5d6173f5c..95da611f13 100644
--- a/test/fixedbugs/issue42284.go
+++ b/test/fixedbugs/issue42284.go
@@ -1,5 +1,8 @@
// errorcheckdir -0 -m
+//go:build !goexperiment.newinliner
+// +build !goexperiment.newinliner
+
// Copyright 2020 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.
diff --git a/test/fixedbugs/issue7921.go b/test/fixedbugs/issue7921.go
index f9efb7f55d..0f09951c96 100644
--- a/test/fixedbugs/issue7921.go
+++ b/test/fixedbugs/issue7921.go
@@ -1,6 +1,7 @@
-// +build !gcflags_noopt
// errorcheck -0 -m
+//go:build !gcflags_noopt && !goexperiment.newinliner
+
// Copyright 2018 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.