cmd/compile: restore zero assignment optimization for non-pointer types

golang.org/cl/31572 disabled some write barrier optimizations, but
inadvertantly disabled optimizations for some non-pointer composite
literal assignments too.

Fixes #18370.

Change-Id: Ia25019bd3016b6ab58173298c7d16202676bce6b
Reviewed-on: https://go-review.googlesource.com/34564
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:
Matthew Dempsky 2016-12-19 08:19:50 -08:00
parent 12979345b1
commit 75d367e34b

View file

@ -694,6 +694,10 @@ opswitch:
break
}
if !instrumenting && iszero(n.Right) && !needwritebarrier(n.Left, n.Right) {
break
}
switch n.Right.Op {
default:
n.Right = walkexpr(n.Right, init)