]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: omit saved .closureptr in optimized code
authorDavid Chase <drchase@google.com>
Mon, 14 Oct 2024 16:51:29 +0000 (12:51 -0400)
committerDavid Chase <drchase@google.com>
Fri, 18 Oct 2024 17:19:13 +0000 (17:19 +0000)
This worsens debugging, but improves performance.

Change-Id: I7f3c0d174823b3de412478f9537adc61ae4c076e
Reviewed-on: https://go-review.googlesource.com/c/go/+/620219
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
src/cmd/compile/internal/ssagen/ssa.go

index 6a65bb0235c06f058497ed83e659b2ff980694ec..ba09216f8f691a41e4daf30687a0540a8fa9743e 100644 (file)
@@ -521,7 +521,7 @@ func buildssa(fn *ir.Func, worker int, isPgoHot bool) *ssa.Func {
        // Populate closure variables.
        if fn.Needctxt() {
                clo := s.entryNewValue0(ssa.OpGetClosurePtr, s.f.Config.Types.BytePtr)
-               if fn.RangeParent != nil {
+               if fn.RangeParent != nil && base.Flag.N != 0 {
                        // For a range body closure, keep its closure pointer live on the
                        // stack with a special name, so the debugger can look for it and
                        // find the parent frame.