From: Matthew Dempsky Date: Fri, 1 Apr 2016 23:43:43 +0000 (-0700) Subject: cmd/compile: eliminate dead code in walkappend X-Git-Tag: go1.7beta1~946 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=75a22d0d107d291c2dbb78dce7017cffe6531b49;p=gostls13.git 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 Reviewed-by: Brad Fitzpatrick --- diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go index 6576daadac..77e6c4e1c0 100644 --- a/src/cmd/compile/internal/gc/walk.go +++ b/src/cmd/compile/internal/gc/walk.go @@ -2893,10 +2893,6 @@ func walkappend(n *Node, init *Nodes, dst *Node) *Node { nsrc := n.List.First() - // Resolve slice type of multi-valued return. - if nsrc.Type.IsStruct() { - nsrc.Type = nsrc.Type.Elem().Elem() - } argc := n.List.Len() - 1 if argc < 1 { return nsrc