diff --git a/src/cmd/compile/internal/ssa/deadcode.go b/src/cmd/compile/internal/ssa/deadcode.go index 2be7b8ebaf..1b1ae27e58 100644 --- a/src/cmd/compile/internal/ssa/deadcode.go +++ b/src/cmd/compile/internal/ssa/deadcode.go @@ -44,7 +44,10 @@ func deadcode(f *Func) { // pop a reachable value v := q[len(q)-1] q = q[:len(q)-1] - for _, x := range v.Args { + for i, x := range v.Args { + if v.Op == OpPhi && !reachable[v.Block.Preds[i].ID] { + continue + } if !live[x.ID] { live[x.ID] = true q = append(q, x) // push