]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: add x.Uses==1 test to load combiners
authorKeith Randall <khr@golang.org>
Tue, 12 Apr 2016 04:23:11 +0000 (21:23 -0700)
committerKeith Randall <khr@golang.org>
Tue, 12 Apr 2016 15:10:16 +0000 (15:10 +0000)
commitcd85f711c0b6847cbfe4e05f4402df075ea936de
treed9fa34021c95884eec601e218c9ff2ab03cb8d88
parent204b6f48c5107d3132033324fd492ca0253568dc
cmd/compile: add x.Uses==1 test to load combiners

We need to make sure that when we combine loads, we only do
so if there are no other uses of the load.  We can't split
one load into two because that can then lead to inconsistent
loaded values in the presence of races.

Add some aggressive copy removal code so that phantom
"dead copy" uses of values are cleaned up promptly.  This lets
us use x.Uses==1 conditions reliably.

Change-Id: I9037311db85665f3868dbeb3adb3de5c20728b38
Reviewed-on: https://go-review.googlesource.com/21853
Reviewed-by: Todd Neal <todd@tneal.org>
src/cmd/compile/internal/gc/ssa_test.go
src/cmd/compile/internal/gc/testdata/dupLoad.go [new file with mode: 0644]
src/cmd/compile/internal/gc/testdata/namedReturn.go
src/cmd/compile/internal/ssa/gen/AMD64.rules
src/cmd/compile/internal/ssa/nilcheck_test.go
src/cmd/compile/internal/ssa/rewrite.go
src/cmd/compile/internal/ssa/rewriteAMD64.go