]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/walk: copy SSA-able variables
authorMatthew Dempsky <mdempsky@google.com>
Sat, 11 Nov 2023 02:03:00 +0000 (18:03 -0800)
committerGopher Robot <gobot@golang.org>
Tue, 21 Nov 2023 20:34:12 +0000 (20:34 +0000)
commit00715d089d68c1dd43ed1f508e8937c5208fb6f0
treedddcdb7b64fc1df98b458e4bb893615b725aa214
parente5615ad876aee4974aa1eb2683d545d82e173a58
cmd/compile/internal/walk: copy SSA-able variables

order.go ensures expressions that are passed to the runtime by address
are in fact addressable. However, in the case of local variables, if the
variable hasn't already been marked as addrtaken, then taking its
address here will effectively prevent the variable from being converted
to SSA form.

Instead, it's better to just copy the variable into a new temporary,
which we can pass by address instead. This ensures the original variable
can still be converted to SSA form.

Fixes #63332.

Change-Id: I182376d98d419df8bf07c400d84c344c9b82c0fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/541715
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>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/walk/order.go
test/codegen/issue63332.go [new file with mode: 0644]