aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/escape
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2021-01-17 00:17:59 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2021-01-17 06:37:18 +0000
commit88956fc4b1a44efe847fa07a8ebc21a49ff811e1 (patch)
treef4c56af173c318a3b73dd5025926a3f521361335 /src/cmd/compile/internal/escape
parent7ce2a8383d154ca1860286a9b5c8a1e6cf151a90 (diff)
downloadgo-88956fc4b1a44efe847fa07a8ebc21a49ff811e1.tar.gz
go-88956fc4b1a44efe847fa07a8ebc21a49ff811e1.zip
[dev.regabi] cmd/compile: stop analyze NameOffsetExpr.Name_ in escape analysis
It is always used with global variables, so we can skip analyze it, the same as what we are doing for ONAME/PEXTERN nodes. While at it, add a Fatalf check to ensure NewNameOffsetExpr is only called for global variables. For #43737 Change-Id: Iac444ed8d583baba5042bea096531301843b1e8f Reviewed-on: https://go-review.googlesource.com/c/go/+/284118 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/escape')
-rw-r--r--src/cmd/compile/internal/escape/escape.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/cmd/compile/internal/escape/escape.go b/src/cmd/compile/internal/escape/escape.go
index 96c2e02146..356fbc75f8 100644
--- a/src/cmd/compile/internal/escape/escape.go
+++ b/src/cmd/compile/internal/escape/escape.go
@@ -585,7 +585,7 @@ func (e *escape) exprSkipInit(k hole, n ir.Node) {
default:
base.Fatalf("unexpected expr: %v", n)
- case ir.OLITERAL, ir.ONIL, ir.OGETG, ir.OTYPE, ir.OMETHEXPR:
+ case ir.OLITERAL, ir.ONIL, ir.OGETG, ir.OTYPE, ir.OMETHEXPR, ir.ONAMEOFFSET:
// nop
case ir.ONAME:
@@ -598,10 +598,6 @@ func (e *escape) exprSkipInit(k hole, n ir.Node) {
}
e.flow(k, e.oldLoc(n))
- case ir.ONAMEOFFSET:
- n := n.(*ir.NameOffsetExpr)
- e.expr(k, n.Name_)
-
case ir.OPLUS, ir.ONEG, ir.OBITNOT, ir.ONOT:
n := n.(*ir.UnaryExpr)
e.discard(n.X)
@@ -876,8 +872,7 @@ func (e *escape) addr(n ir.Node) hole {
}
k = e.oldLoc(n).asHole()
case ir.ONAMEOFFSET:
- n := n.(*ir.NameOffsetExpr)
- k = e.addr(n.Name_)
+ break
case ir.ODOT:
n := n.(*ir.SelectorExpr)
k = e.addr(n.X)