1
0
mirror of https://github.com/golang/go synced 2024-11-22 09:34:54 -07:00

cmd/compile: discount calls to closure variables

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>
This commit is contained in:
David Chase 2024-10-14 13:28:28 -04:00
parent a464ffda3e
commit ad7f736d8f

View 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)
}
}