From: Matthew Dempsky Date: Thu, 26 Sep 2019 18:00:13 +0000 (-0700) Subject: cmd/compile: remove pointer temporaries in walkcompare X-Git-Tag: go1.14beta1~913 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e76b9e8908bdcdb4363d6bd23aa7ff3120237426;p=gostls13.git cmd/compile: remove pointer temporaries in walkcompare When comparing two T-typed values t1 and t2 using the T_eq function, we used to generate: pl := &t1 pr := &t2 return T_eq(pl, pr, unsafe.Sizeof(T{})) This CL changes it to simply generate: return T_eq(&t1, &t2, unsafe.Sizeof(T{})) Surprisingly, this does not pass toolstash. For some reason, it seems like SSA wasn't able to SSA-ify the pl and pr variables in all cases. Change-Id: I111fbb068a1741fa169c9922cb8cdb6e21579aa4 Reviewed-on: https://go-review.googlesource.com/c/go/+/197601 Run-TryBot: Matthew Dempsky TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go index e19b6329ba..727c8102ae 100644 --- a/src/cmd/compile/internal/gc/walk.go +++ b/src/cmd/compile/internal/gc/walk.go @@ -3130,20 +3130,10 @@ func walkcompare(n *Node, init *Nodes) *Node { Fatalf("arguments of comparison must be lvalues - %v %v", cmpl, cmpr) } - pl := temp(types.NewPtr(t)) - al := nod(OAS, pl, nod(OADDR, cmpl, nil)) - al = typecheck(al, ctxStmt) - init.Append(al) - - pr := temp(types.NewPtr(t)) - ar := nod(OAS, pr, nod(OADDR, cmpr, nil)) - ar = typecheck(ar, ctxStmt) - init.Append(ar) - fn, needsize := eqfor(t) call := nod(OCALL, fn, nil) - call.List.Append(pl) - call.List.Append(pr) + call.List.Append(nod(OADDR, cmpl, nil)) + call.List.Append(nod(OADDR, cmpr, nil)) if needsize { call.List.Append(nodintconst(t.Width)) }