aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/deadstore.go
diff options
context:
space:
mode:
authorMichael Munday <mike.munday@ibm.com>2018-06-30 10:14:49 +0100
committerBrad Fitzpatrick <bradfitz@golang.org>2018-07-02 19:43:07 +0000
commitadfa8b86915296d1e98ce695420fc6d1faba6eb6 (patch)
tree428c719f266e94fbc5af2d960b62a6386420b356 /src/cmd/compile/internal/ssa/deadstore.go
parent23ce272bb1154fb8085c8fc1e3c1f1e0e760f005 (diff)
downloadgo-adfa8b86915296d1e98ce695420fc6d1faba6eb6.tar.gz
go-adfa8b86915296d1e98ce695420fc6d1faba6eb6.zip
cmd/compile: keep autos whose address reaches a phi
If the address of an auto reaches a phi then any further stores to the pointer represented by the phi probably need to be kept. This is because stores to the other arguments to the phi may be visible to the program. Fixes #26153. Change-Id: Ic506c6c543bf70d792e5b1a64bdde1e5fdf1126a Reviewed-on: https://go-review.googlesource.com/121796 Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/deadstore.go')
-rw-r--r--src/cmd/compile/internal/ssa/deadstore.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/ssa/deadstore.go b/src/cmd/compile/internal/ssa/deadstore.go
index 4b2f57dcd9..e92521a79c 100644
--- a/src/cmd/compile/internal/ssa/deadstore.go
+++ b/src/cmd/compile/internal/ssa/deadstore.go
@@ -203,7 +203,8 @@ func elimDeadAutosGeneric(f *Func) {
// If the address of the auto reaches a memory or control
// operation not covered above then we probably need to keep it.
- if v.Type.IsMemory() || v.Type.IsFlags() || (v.Op != OpPhi && v.MemoryArg() != nil) {
+ // We also need to keep autos if they reach Phis (issue #26153).
+ if v.Type.IsMemory() || v.Type.IsFlags() || v.Op == OpPhi || v.MemoryArg() != nil {
for _, a := range args {
if n, ok := addr[a]; ok {
if !used[n] {