diff options
author | Keith Randall <khr@golang.org> | 2015-07-11 14:41:22 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2015-07-11 22:45:14 +0000 |
commit | 050ce4390aa16b03e7272e22e79de165589319b5 (patch) | |
tree | 6d91d5d441d50ca5361c59a824b21d1ead5e8297 /src/cmd/compile/internal/ssa/deadcode.go | |
parent | 7a982e3c49c4fc16c2d51bf6e892cb2dd19405be (diff) | |
download | go-050ce4390aa16b03e7272e22e79de165589319b5.tar.gz go-050ce4390aa16b03e7272e22e79de165589319b5.zip |
[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/12091
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/deadcode.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/deadcode.go | 5 |
1 files changed, 4 insertions, 1 deletions
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 |