mirror of
https://github.com/golang/go.git
synced 2025-05-20 23:03:26 +00:00
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: Keith Randall <khr@golang.org>
This commit is contained in:
parent
f91c850be6
commit
ecc2d61798
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user