]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove redundant anylit calls in walkcompare
authorMatthew Dempsky <mdempsky@google.com>
Thu, 26 Sep 2019 17:59:11 +0000 (10:59 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Mon, 30 Sep 2019 23:42:51 +0000 (23:42 +0000)
walkcompare already called walkexpr on n.Left and n.Right, which in
turn calls anylit when appropriate.

Passes toolstash-check.

Change-Id: I6912ac5a42b977c04db9d85cb2e7295e275e083d
Reviewed-on: https://go-review.googlesource.com/c/go/+/197600
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/walk.go

index 7f73d416e81021a3772dbb66152ae43c1042f18f..e19b6329bad4adc7e7224e538b0bf1c0a5b5eaff 100644 (file)
@@ -3125,21 +3125,11 @@ func walkcompare(n *Node, init *Nodes) *Node {
 
        // Chose not to inline. Call equality function directly.
        if !inline {
-               if isvaluelit(cmpl) {
-                       var_ := temp(cmpl.Type)
-                       anylit(cmpl, var_, init)
-                       cmpl = var_
-               }
-               if isvaluelit(cmpr) {
-                       var_ := temp(cmpr.Type)
-                       anylit(cmpr, var_, init)
-                       cmpr = var_
-               }
+               // eq algs take pointers; cmpl and cmpr must be addressable
                if !islvalue(cmpl) || !islvalue(cmpr) {
                        Fatalf("arguments of comparison must be lvalues - %v %v", cmpl, cmpr)
                }
 
-               // eq algs take pointers
                pl := temp(types.NewPtr(t))
                al := nod(OAS, pl, nod(OADDR, cmpl, nil))
                al = typecheck(al, ctxStmt)