]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: discount calls to closure variables
authorDavid Chase <drchase@google.com>
Mon, 14 Oct 2024 17:28:28 +0000 (13:28 -0400)
committerDavid Chase <drchase@google.com>
Tue, 22 Oct 2024 18:15:24 +0000 (18:15 +0000)
This causes more inlining for rangefunc code.
The PAUTOHEAP case catches closure-passed-as-param
to function that returns a closure, that calls the
outer PPARAM.

Change-Id: I927cf2e1924ed2191e0ad8be9a1f2e793b6f2b38
Reviewed-on: https://go-review.googlesource.com/c/go/+/620220
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/cmd/compile/internal/inline/inl.go

index c38ed8be7fb12a1cb4064c09a1144125015727d8..e3462f54ec6b5d5f338a938402c0951499d46cbc 100644 (file)
@@ -544,7 +544,7 @@ opSwitch:
                                        }
                                }
                        }
-                       if name.Class == ir.PPARAM {
+                       if name.Class == ir.PPARAM || name.Class == ir.PAUTOHEAP && name.IsClosureVar() {
                                extraCost = min(extraCost, inlineParamCallCost)
                        }
                }