aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2016-12-19 08:19:50 -0800
committerMatthew Dempsky <mdempsky@google.com>2016-12-19 17:25:26 +0000
commit75d367e34b42b8428d535122eadead87a0c11c8c (patch)
treeca6e95402cc426dba35ff395e3bc7a9526c62c43
parent12979345b1166163788846453f396afafdf1503a (diff)
downloadgo-75d367e34b42b8428d535122eadead87a0c11c8c.tar.gz
go-75d367e34b42b8428d535122eadead87a0c11c8c.zip
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>
-rw-r--r--src/cmd/compile/internal/gc/walk.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go
index 8248d503b3..efe2016e46 100644
--- a/src/cmd/compile/internal/gc/walk.go
+++ b/src/cmd/compile/internal/gc/walk.go
@@ -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)