]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: handle loops better during stack allocation of slices
authorKeith Randall <khr@golang.org>
Thu, 20 Nov 2025 17:42:16 +0000 (09:42 -0800)
committerKeith Randall <khr@golang.org>
Wed, 26 Nov 2025 21:33:51 +0000 (13:33 -0800)
commit3c6bf6fbf38062b24a7cf0390f1e617d733851b3
treef7633e2d43d13d9976b6642b2f2a2d44e39f6e14
parentefe9ad501d94743d87e500a7ba0b1732a89e9afd
cmd/compile: handle loops better during stack allocation of slices

Don't use the move2heap optimization if the move2heap is inside
a loop deeper than the declaration of the slice. We really only want
to do the move2heap operation once.

Change-Id: I4a68d01609c2c9d4e0abe4580839e70059393a81
Reviewed-on: https://go-review.googlesource.com/c/go/+/722440
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/compile/internal/slice/slice.go
test/codegen/append.go