]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix static init inlining for hidden node fields
authorMatthew Dempsky <mdempsky@google.com>
Tue, 17 Jan 2023 18:59:25 +0000 (10:59 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 17 Jan 2023 22:13:42 +0000 (22:13 +0000)
commitf773bef9ab837db1bd81df375a701196b23ac510
tree69c69d4999ba1a8fc5082fae8b2b5e6c28a5e7ba
parentd45df06663c88984b75052fd0631974916b1bddb
cmd/compile: fix static init inlining for hidden node fields

Unified IR added several new IR fields for holding *runtime._type
expressions. To avoid throwing off any frontend semantics
(particularly inlining cost heuristics), they were marked as
`mknode:"-"` so that code wouldn't visit them.

Unfortunately, this has a bad interaction with the static init
inlining optimization, because the latter relies on ir.EditChildren to
substitute all parameters. This potentially includes dictionary
parameters, which can appear within the new RType fields.

This CL adds a new ir.EditChildrenWithHidden function that also edits
these fields, and switches staticinit to use it. Longer term, we
should unhide the RType fields so that ir.EditChildren visits them
normally, but that's scarier so late in the release cycle.

Fixes #57778.

Change-Id: I98c1e8cf366156dc0c81a0cb79029cc5e59c476f
Reviewed-on: https://go-review.googlesource.com/c/go/+/461686
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
src/cmd/compile/internal/ir/func.go
src/cmd/compile/internal/ir/mknode.go
src/cmd/compile/internal/ir/name.go
src/cmd/compile/internal/ir/node.go
src/cmd/compile/internal/ir/node_gen.go
src/cmd/compile/internal/ir/visit.go
src/cmd/compile/internal/staticinit/sched.go
test/fixedbugs/issue57778.go [new file with mode: 0644]