cmd/compile: omit saved .closureptr in optimized code

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>
This commit is contained in:
David Chase 2024-10-14 12:51:29 -04:00
parent 6853d89477
commit a9ad0ff6ba
1 changed files with 1 additions and 1 deletions

View 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.