]> Cypherpunks.ru repositories - gostls13.git/commit
[release-branch.go1.21] cmd/compile: fix missing init nodes for len(string([]byte...
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Sat, 5 Aug 2023 15:51:49 +0000 (22:51 +0700)
committerMichael Knyszek <mknyszek@google.com>
Fri, 11 Aug 2023 14:53:01 +0000 (14:53 +0000)
commit1755d1455977cb9dc6cdfa032dfd1c370e2a4097
tree0a972d65f344f9b91b813774e19bc90dbcfb08ee
parentc19c4c566c63818dfd059b352e52c4710eecf14d
[release-branch.go1.21] cmd/compile: fix missing init nodes for len(string([]byte)) optimization

CL 497276 added optimization for len(string([]byte)) by avoiding call to
slicebytetostring. However, the bytes to string expression may contain
init nodes, which need to be preserved. Otherwise, it would make the
liveness analysis confusing about the lifetime of temporary variables
created by init nodes.

Fixes #61781

Change-Id: I6d1280a7d61bcc75f11132af41bda086f084ab54
Reviewed-on: https://go-review.googlesource.com/c/go/+/516375
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/516535
src/cmd/compile/internal/walk/builtin.go
test/fixedbugs/issue61778.go [new file with mode: 0644]