From 34e38ac99f025549599ea7e1ad2e80026ae16174 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Sun, 12 Apr 2020 23:38:36 +0700 Subject: [PATCH] cmd/compile: remove "special return in disguise" case 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 TryBot-Result: Gobot Gobot Reviewed-by: Matthew Dempsky --- src/cmd/compile/internal/gc/walk.go | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go index 9eab170ddb..56062f8c57 100644 --- a/src/cmd/compile/internal/gc/walk.go +++ b/src/cmd/compile/internal/gc/walk.go @@ -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) -- 2.50.0