aboutsummaryrefslogtreecommitdiff
path: root/test/closure3.dir
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2023-04-03 14:25:58 +0000
committerThan McIntosh <thanm@google.com>2023-04-03 14:51:33 +0000
commitf5371581c73f2153bb7e7c85648896ff8bdce845 (patch)
tree1de973da16c221d45b85d8e4b442bc29defd4479 /test/closure3.dir
parent8edcdddb23c6d3f786b465c43b49e8d9a0015082 (diff)
downloadgo-f5371581c73f2153bb7e7c85648896ff8bdce845.tar.gz
go-f5371581c73f2153bb7e7c85648896ff8bdce845.zip
Revert "cmd/compile: allow more inlining of functions that construct closures"
This reverts commit http://go.dev/cl//479095 Reason for revert: causes failures in google-internal testing Change-Id: If1018b35be0b8627e2959f116179ada24d44d67c Reviewed-on: https://go-review.googlesource.com/c/go/+/481637 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> Run-TryBot: Than McIntosh <thanm@google.com>
Diffstat (limited to 'test/closure3.dir')
-rw-r--r--test/closure3.dir/main.go26
1 files changed, 11 insertions, 15 deletions
diff --git a/test/closure3.dir/main.go b/test/closure3.dir/main.go
index 04a669206e..4d02a4d10e 100644
--- a/test/closure3.dir/main.go
+++ b/test/closure3.dir/main.go
@@ -232,15 +232,15 @@ func main() {
{
c := 3
- func() { // ERROR "can inline main.func26"
+ func() { // ERROR "func literal does not escape"
c = 4
- func() {
+ func() { // ERROR "func literal does not escape"
if c != 4 {
ppanic("c != 4")
}
recover() // prevent inlining
}()
- }() // ERROR "inlining call to main.func26" "func literal does not escape"
+ }()
if c != 4 {
ppanic("c != 4")
}
@@ -248,37 +248,33 @@ func main() {
{
a := 2
- // This has an unfortunate exponential growth, where as we visit each
- // function, we inline the inner closure, and that constructs a new
- // function for any closures inside the inner function, and then we
- // revisit those. E.g., func34 and func36 are constructed by the inliner.
- if r := func(x int) int { // ERROR "can inline main.func27"
+ if r := func(x int) int { // ERROR "func literal does not escape"
b := 3
- return func(y int) int { // ERROR "can inline main.func27.1" "can inline main.func34"
+ return func(y int) int { // ERROR "can inline main.func27.1"
c := 5
- return func(z int) int { // ERROR "can inline main.func27.1.1" "can inline main.func27.(func)?2" "can inline main.func34.1" "can inline main.func36"
+ return func(z int) int { // ERROR "can inline main.func27.1.1" "can inline main.func27.(func)?2"
return a*x + b*y + c*z
}(10) // ERROR "inlining call to main.func27.1.1"
}(100) // ERROR "inlining call to main.func27.1" "inlining call to main.func27.(func)?2"
- }(1000); r != 2350 { // ERROR "inlining call to main.func27" "inlining call to main.func34" "inlining call to main.func36"
+ }(1000); r != 2350 {
ppanic("r != 2350")
}
}
{
a := 2
- if r := func(x int) int { // ERROR "can inline main.func28"
+ if r := func(x int) int { // ERROR "func literal does not escape"
b := 3
- return func(y int) int { // ERROR "can inline main.func28.1" "can inline main.func35"
+ return func(y int) int { // ERROR "can inline main.func28.1"
c := 5
- func(z int) { // ERROR "can inline main.func28.1.1" "can inline main.func28.(func)?2" "can inline main.func35.1" "can inline main.func37"
+ func(z int) { // ERROR "can inline main.func28.1.1" "can inline main.func28.(func)?2"
a = a * x
b = b * y
c = c * z
}(10) // ERROR "inlining call to main.func28.1.1"
return a + c
}(100) + b // ERROR "inlining call to main.func28.1" "inlining call to main.func28.(func)?2"
- }(1000); r != 2350 { // ERROR "inlining call to main.func28" "inlining call to main.func35" "inlining call to main.func37"
+ }(1000); r != 2350 {
ppanic("r != 2350")
}
if a != 2000 {