]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/devirtualize: do not track assignments to non-PAUTO
authorMateusz Poliwczak <mpoliwczak34@gmail.com>
Sun, 12 Oct 2025 09:24:32 +0000 (11:24 +0200)
committerGopher Robot <gobot@golang.org>
Tue, 14 Oct 2025 18:31:45 +0000 (11:31 -0700)
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>
src/cmd/compile/internal/devirtualize/devirtualize.go

index dfcdd42236dccad201b891d65bf937047fd4c78b..cb4608a024657453bee664295de46b3f19482de3 100644 (file)
@@ -387,6 +387,9 @@ func (s *State) assignments(n *ir.Name) []assignment {
        if fun == nil {
                base.FatalfAt(n.Pos(), "n.Curfn = <nil>")
        }
+       if n.Class != ir.PAUTO {
+               base.FatalfAt(n.Pos(), "n.Class = %v; want = PAUTO", n.Class)
+       }
 
        if !n.Type().IsInterface() {
                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) {
                if n.Op() != ir.ONAME {
                        base.FatalfAt(n.Pos(), "n.Op = %v; want = ONAME", n.Op())
                }
+               if n.Class != ir.PAUTO {
+                       return nil, -1
+               }
 
                switch a := assignment.(type) {
                case nil: