]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: eliminate stores to unread auto variables
authorMichael Munday <mike.munday@ibm.com>
Wed, 29 Mar 2017 18:01:41 +0000 (14:01 -0400)
committerMichael Munday <mike.munday@ibm.com>
Thu, 24 Aug 2017 16:53:56 +0000 (16:53 +0000)
commit744ebfde0460e1d8fff10672e4d1e8d9ece52556
tree30f9eca8178f7ce2b7534ab394e0e1dac4e42e60
parent18b48afec9be0a1da4b23bebace0dc9f081dcee1
cmd/compile: eliminate stores to unread auto variables

This is a crude compiler pass to eliminate stores to auto variables
that are only ever written to.

Eliminates an unnecessary store to x from the following code:

func f() int {
var x := 1
return *(&x)
}

Fixes #19765.

Change-Id: If2c63a8ae67b8c590b6e0cc98a9610939a3eeffa
Reviewed-on: https://go-review.googlesource.com/38746
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/asm_test.go
src/cmd/compile/internal/gc/plive.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/ssa/compile.go
src/cmd/compile/internal/ssa/deadstore.go
src/runtime/runtime-gdb_test.go
test/live.go
test/live2.go