]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove nil check in accessing PAUTOHEAP variable
authorCherry Zhang <cherryyz@google.com>
Thu, 11 Aug 2016 13:54:04 +0000 (09:54 -0400)
committerCherry Zhang <cherryyz@google.com>
Tue, 16 Aug 2016 14:32:13 +0000 (14:32 +0000)
CL 23393 introduces PAUTOHEAP, and access of PAUTOHEAP variable is
rewritten to indirection of a PAUTO variable. Mark this variable
non-nil, so this indirection does not introduce extra nil checks.

Change-Id: I31853eed5e60238b6c5bc0546e2e9ab340dcddd9
Reviewed-on: https://go-review.googlesource.com/26831
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/walk.go

index 1e7d80d3e931c46a6f9efb185610ee58443ab3ff..88ac347ad7f51aaf1278cf2a8e80504ac0ae75a4 100644 (file)
@@ -506,7 +506,9 @@ func walkexpr(n *Node, init *Nodes) *Node {
        if n.Op == ONAME && n.Class == PAUTOHEAP {
                nn := Nod(OIND, n.Name.Heapaddr, nil)
                nn = typecheck(nn, Erv)
-               return walkexpr(nn, init)
+               nn = walkexpr(nn, init)
+               nn.Left.NonNil = true
+               return nn
        }
 
 opswitch: