]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: improve unneeded zeroing removal
authorKeith Randall <khr@golang.org>
Tue, 13 Aug 2024 16:01:05 +0000 (09:01 -0700)
committerGopher Robot <gobot@golang.org>
Wed, 14 Aug 2024 18:16:29 +0000 (18:16 +0000)
commitb2cdaf73469d7f15181b3abfb7b168475375c373
tree42fcd55a8444da69dc8f15f7bd2a2c31480e2381
parent8b32ce586de9a4120bc7cdc104801113bed89f1d
cmd/compile: improve unneeded zeroing removal

After newobject, we don't need to write zeroes to initialize the
object.  It has already been zeroed by the allocator.

This is already handled in most cases, but because we run builtin
decomposition after the opt pass, we don't handle cases where the zero
of a compound builtin is being written. Improve the zero detector to
handle those cases.

Fixes #68845

Change-Id: If3dde2e304a05e5a6a6723565191d5444b334bcc
Reviewed-on: https://go-review.googlesource.com/c/go/+/605255
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
src/cmd/compile/internal/ssa/rewrite.go
test/codegen/issue68845.go [new file with mode: 0644]