Commit ecc2d617 authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile: remove redundant anylit calls in walkcompare

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: default avatarKeith Randall <khr@golang.org>
parent f91c850b
...@@ -3125,21 +3125,11 @@ func walkcompare(n *Node, init *Nodes) *Node { ...@@ -3125,21 +3125,11 @@ func walkcompare(n *Node, init *Nodes) *Node {
// Chose not to inline. Call equality function directly. // Chose not to inline. Call equality function directly.
if !inline { if !inline {
if isvaluelit(cmpl) { // eq algs take pointers; cmpl and cmpr must be addressable
var_ := temp(cmpl.Type)
anylit(cmpl, var_, init)
cmpl = var_
}
if isvaluelit(cmpr) {
var_ := temp(cmpr.Type)
anylit(cmpr, var_, init)
cmpr = var_
}
if !islvalue(cmpl) || !islvalue(cmpr) { if !islvalue(cmpl) || !islvalue(cmpr) {
Fatalf("arguments of comparison must be lvalues - %v %v", cmpl, cmpr) Fatalf("arguments of comparison must be lvalues - %v %v", cmpl, cmpr)
} }
// eq algs take pointers
pl := temp(types.NewPtr(t)) pl := temp(types.NewPtr(t))
al := nod(OAS, pl, nod(OADDR, cmpl, nil)) al := nod(OAS, pl, nod(OADDR, cmpl, nil))
al = typecheck(al, ctxStmt) al = typecheck(al, ctxStmt)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment