]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.22] cmd/compile: add 0-sized-value simplification to copyelim
authorDavid Chase <drchase@google.com>
Thu, 29 Feb 2024 20:02:44 +0000 (15:02 -0500)
committerMichael Knyszek <mknyszek@google.com>
Wed, 31 Jul 2024 16:13:05 +0000 (16:13 +0000)
commit8c8adffd5301b5e40a8c39e92030c53c856fb1a6
treefdb805a95bf279d3cd2268b5c35de490ce94bae1
parent70a1aae67f832f32ac840e1d957deefffd00079b
[release-branch.go1.22] cmd/compile: add 0-sized-value simplification to copyelim

The problem was caused by faulty handling of unSSA-able
operations on zero-sized data in expand calls, but there
is no point to operations on zero-sized data.  This CL adds
a simplify step to the first place in SSA where all values
are processed and replaces anything producing a 0-sized
struct/array with the corresponding Struct/Array Make0
operation (of the appropriate type).

I attempted not generating them in ssagen, but that was a
larger change, and also had bugs. This is simple and obvious.
The only question is whether it would be worthwhile to do it
earlier (in numberlines or phielem).

Fixes #68594.
Fixes #68585.

Change-Id: I0a596b3d272798015e7bb6b1a20411241759fe0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/568258
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
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>
(cherry picked from commit 6f5d77454e31be8af11a7e2bcda36d200fda07c5)
Reviewed-on: https://go-review.googlesource.com/c/go/+/601195
src/cmd/compile/internal/ssa/copyelim.go
test/fixedbugs/issue65808.go [new file with mode: 0644]