aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2016-08-11 09:54:04 -0400
committerCherry Zhang <cherryyz@google.com>2016-08-16 14:32:13 +0000
commit4c4ca8312064cc47bc3b3cd5efc43ff5b89f4dff (patch)
tree31e396a45aa7166c900934bd2252aa329ea0de4a
parent40cf4ad0ef2232d65a85d35897ea11aab95e9ef4 (diff)
downloadgo-4c4ca8312064cc47bc3b3cd5efc43ff5b89f4dff.tar.gz
go-4c4ca8312064cc47bc3b3cd5efc43ff5b89f4dff.zip
cmd/compile: remove nil check in accessing PAUTOHEAP variable
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>
-rw-r--r--src/cmd/compile/internal/gc/walk.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go
index 1e7d80d3e9..88ac347ad7 100644
--- a/src/cmd/compile/internal/gc/walk.go
+++ b/src/cmd/compile/internal/gc/walk.go
@@ -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: