cmd/compile: remove last manual node copies

When I added the Node.copy method, I converted most of the occurrences
but missed a few.

One of them, used only for gdata, was an unnecessary copy given that
gdata does not modify the node it is passed.

No allocation changes in compilebench.

Passes toolstash -cmp on std cmd.

Change-Id: I7fba5212377b75c6d6b3785e594a30568ff0732e
Reviewed-on: https://go-review.googlesource.com/104937
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Daniel Martí 2018-04-05 14:45:38 +01:00
parent 7cb7d62950
commit 60fee0153f
2 changed files with 10 additions and 12 deletions

View file

@ -1184,9 +1184,8 @@ func setconst(n *Node, v Val) {
// Ensure n.Orig still points to a semantically-equivalent
// expression after we rewrite n into a constant.
if n.Orig == n {
var ncopy Node
n.Orig = &ncopy
ncopy = *n
n.Orig = n.copy()
n.Orig.Orig = n.Orig
}
*n = Node{