aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2020-09-10 22:41:29 -0400
committerCherry Zhang <cherryyz@google.com>2020-09-11 13:53:03 +0000
commitb22af9b407dc29d1a733976484904ad0ab168466 (patch)
tree93c5e3055ee8cd4ee9084fc27df683a981f5bfe1
parent03a686069191e3515c7f27f6d90b66d272e0e3a2 (diff)
downloadgo-b22af9b407dc29d1a733976484904ad0ab168466.tar.gz
go-b22af9b407dc29d1a733976484904ad0ab168466.zip
cmd/link: record only the first occurance in Reachparent graph
In the deadcode pass, a type symbol may be marked twice, one without UsedInIface, one with. For the second time, don't update the Reachparent graph, so it only records the path of the first time the symbol is reached. This ensures the Reachparent graph is acyclic. TODO: add a test. (This only affects GOEXPERIMENT=fieldtrack) Change-Id: I68e8a1a69c3830bc8aee5df946151dc22dcb2b29 Reviewed-on: https://go-review.googlesource.com/c/go/+/254297 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
-rw-r--r--src/cmd/link/internal/ld/deadcode.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go
index 0269429723..35545f950e 100644
--- a/src/cmd/link/internal/ld/deadcode.go
+++ b/src/cmd/link/internal/ld/deadcode.go
@@ -209,7 +209,7 @@ func (d *deadcodePass) mark(symIdx, parent loader.Sym) {
if symIdx != 0 && !d.ldr.AttrReachable(symIdx) {
d.wq.push(symIdx)
d.ldr.SetAttrReachable(symIdx, true)
- if objabi.Fieldtrack_enabled != 0 {
+ if objabi.Fieldtrack_enabled != 0 && d.ldr.Reachparent[symIdx] == 0 {
d.ldr.Reachparent[symIdx] = parent
}
if *flagDumpDep {