mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.simd] cmd/compile: remove stores to unread parameters
Currently, we remove stores to local variables that are not read. We don't do that for arguments. But arguments and locals are essentially the same. Arguments are passed by value, and are not expected to be read in the caller's frame. So we can remove the writes to them as well. One exception is the cgo_unsafe_arg directive, which makes all the arguments effectively address-taken. cgo_unsafe_arg implies ABI0, so we just skip ABI0 functions' arguments. Change-Id: I8999fc50da6a87f22c1ec23e9a0c15483b6f7df8 Reviewed-on: https://go-review.googlesource.com/c/go/+/705815 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
This commit is contained in:
parent
2d8cb80d7c
commit
2b50ffe172
3 changed files with 26 additions and 4 deletions
|
|
@ -168,3 +168,9 @@ func getp1() *[4]int {
|
|||
func getp2() *[4]int {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Store to an argument without read can be removed.
|
||||
func storeArg(a [2]int) {
|
||||
// amd64:-`MOVQ\t\$123,.*\.a\+\d+\(SP\)`
|
||||
a[1] = 123
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue