Commit 050ce439 authored by Keith Randall's avatar Keith Randall

[dev.ssa] cmd/compile/internal/ssa: Phi inputs from dead blocks are not live

Fixes #11676

Change-Id: I941f951633c89bb1454ce6d1d1b4124d46a7d9dd
Reviewed-on: https://go-review.googlesource.com/12091Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 7a982e3c
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment