Skip to content

Commit 4dbf1a5

Browse files
mateusz834gopherbot
authored andcommitted
cmd/compile/internal/devirtualize: do not track assignments to non-PAUTO
We do not lookup/devirtualize such, so we can skip tracking them. Change-Id: I8bdb0b11c694e4b2326c236093508a356a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/711160 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
1 parent 0ddb5ed commit 4dbf1a5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/cmd/compile/internal/devirtualize/devirtualize.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,9 @@ func (s *State) assignments(n *ir.Name) []assignment {
387387
if fun == nil {
388388
base.FatalfAt(n.Pos(), "n.Curfn = <nil>")
389389
}
390+
if n.Class != ir.PAUTO {
391+
base.FatalfAt(n.Pos(), "n.Class = %v; want = PAUTO", n.Class)
392+
}
390393

391394
if !n.Type().IsInterface() {
392395
base.FatalfAt(n.Pos(), "name passed to assignments is not of an interface type: %v", n.Type())
@@ -432,6 +435,9 @@ func (s *State) analyze(nodes ir.Nodes) {
432435
if n.Op() != ir.ONAME {
433436
base.FatalfAt(n.Pos(), "n.Op = %v; want = ONAME", n.Op())
434437
}
438+
if n.Class != ir.PAUTO {
439+
return nil, -1
440+
}
435441

436442
switch a := assignment.(type) {
437443
case nil:

0 commit comments

Comments
 (0)