]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove "special return in disguise" case
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Sun, 12 Apr 2020 16:38:36 +0000 (23:38 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Tue, 14 Apr 2020 07:12:17 +0000 (07:12 +0000)
ascompatee does not generate 'x = x' during return, so we don't have to
check for samelist and disguising special return anymore.

While at it, also remove samelist, as this is the only place it's used.

Passes toolstash-check.

Change-Id: I41c7b077d562aadb5916a61e2ab6229bae3cdef4
Reviewed-on: https://go-review.googlesource.com/c/go/+/227807
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/walk.go

index 9eab170ddbab89486605f2270a259770a60f7ec6..56062f8c570ad00cf5d962ca92df29128f44f6ba 100644 (file)
@@ -81,18 +81,6 @@ func walkstmtlist(s []*Node) {
        }
 }
 
-func samelist(a, b []*Node) bool {
-       if len(a) != len(b) {
-               return false
-       }
-       for i, n := range a {
-               if n != b[i] {
-                       return false
-               }
-       }
-       return true
-}
-
 func paramoutheap(fn *Node) bool {
        for _, ln := range fn.Func.Dcl {
                switch ln.Class() {
@@ -295,16 +283,6 @@ func walkstmt(n *Node) *Node {
                                Fatalf("expected %v return arguments, have %v", want, got)
                        }
 
-                       if samelist(rl, n.List.Slice()) {
-                               // special return in disguise
-                               // TODO(josharian, 1.12): is "special return" still relevant?
-                               // Tests still pass w/o this. See comments on https://go-review.googlesource.com/c/go/+/118318
-                               walkexprlist(n.List.Slice(), &n.Ninit)
-                               n.List.Set(nil)
-
-                               break
-                       }
-
                        // move function calls out, to make reorder3's job easier.
                        walkexprlistsafe(n.List.Slice(), &n.Ninit)