]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.regabi] cmd/compile: make ir.StaticValue safer
authorMatthew Dempsky <mdempsky@google.com>
Tue, 5 Jan 2021 11:27:46 +0000 (03:27 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 5 Jan 2021 14:04:03 +0000 (14:04 +0000)
commite09783cbc0a7142719c6210b4eda7b21daad91d5
treed008da0b27377e50bcce858983e86bc2b2004f59
parent9aa950c40789223d9e8df7d1ec657cd313e6c7aa
[dev.regabi] cmd/compile: make ir.StaticValue safer

ir.StaticValue currently relies on CaptureVars setting Addrtaken for
variables that are assigned within nested function literals. We want
to move that logic to escape analysis, but ir.StaticValue is used in
inlining and devirtualization, which happen before escape
analysis.

The long-term solution here is to generalize escape analysis's precise
reassignment tracking for use by other optimization passes, but for
now we just generalize ir.StaticValue to not depend on Addrtaken
anymore. Instead, it now also pays attention to OADDR nodes as well as
recurses into OCLOSURE bodies.

Passes toolstash -cmp.

Change-Id: I6114e3277fb70b235f4423d2983d0433c881f79f
Reviewed-on: https://go-review.googlesource.com/c/go/+/281540
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/cmd/compile/internal/ir/expr.go