]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: eliminate dead code in walkappend
authorMatthew Dempsky <mdempsky@google.com>
Fri, 1 Apr 2016 23:43:43 +0000 (16:43 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Sat, 2 Apr 2016 00:06:30 +0000 (00:06 +0000)
commit75a22d0d107d291c2dbb78dce7017cffe6531b49
treea7d45d0a45019c2d57eba0df531e9d8fe5ff14fc
parent683448a304a3871039ab44fc01e839f05ac36f05
cmd/compile: eliminate dead code in walkappend

The IsStruct case is meant to handle cases like append(f()) where f's
result parameters are something like ([]int, int, int). However, at
this point in the compiler we've already rewritten append(f()) into
"tmp1, tmp2, tmp3 := f(); append(tmp1, tmp2, tmp3)".

As further evidence, the t.Elem() is not a valid method call for a
struct type anyway, which would trigger the Fatalf call in Type.Elem
if this code was ever hit.

Change-Id: Ia066f93df66ee3fadc9a9a0f687be7b5263af163
Reviewed-on: https://go-review.googlesource.com/21427
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/walk.go