]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove unnecessary write barriers for APPEND
authorCherry Zhang <cherryyz@google.com>
Mon, 3 Oct 2016 19:21:16 +0000 (15:21 -0400)
committerCherry Zhang <cherryyz@google.com>
Mon, 3 Oct 2016 19:35:44 +0000 (19:35 +0000)
Updates #17330.

Change-Id: I83fe80139a2213f3169db884b84a4c3bd15b58b6
Reviewed-on: https://go-review.googlesource.com/30140
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/ssa.go

index f5e1c5f0c73a19236e9483b0932cf660393724bc..419240eab7f3e6ac0d3e38809dd60f44c84aa9bc 100644 (file)
@@ -667,7 +667,7 @@ func (s *state) stmt(n *Node) {
                                r = s.expr(rhs)
                        }
                }
-               if rhs != nil && rhs.Op == OAPPEND {
+               if rhs != nil && rhs.Op == OAPPEND && needwritebarrier(n.Left, rhs) {
                        // The frontend gets rid of the write barrier to enable the special OAPPEND
                        // handling above, but since this is not a special case, we need it.
                        // TODO: just add a ptr graying to the end of growslice?