mirror of
https://github.com/golang/go
synced 2024-11-23 18:20:04 -07:00
cmd/compile: mark instantiated generic functions as DUPOK
Unified IR wasn't marking instantiated generic functions as DUPOK, even though they can appear in multiple compilation units, which evidently interfered with cmd/link's dead code elimination logic. Manually confirmed to fix the issue, but non-trivial to test within $GOROOT/test currently, because it's only reproducible when cmd/compile is invoked with -p. @rsc is currently investigating updating test/run.go appropriately, after which I'll revisit writing a test case. Fixes #51519. Change-Id: I74a79ed0ca15b25b826e419714af5ceb6e567012 Reviewed-on: https://go-review.googlesource.com/c/go/+/390956 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
c6d9b38dd8
commit
7160e32529
@ -644,6 +644,10 @@ func (pr *pkgReader) objIdx(idx int, implicits, explicits []*types.Type) ir.Node
|
||||
name.Func = ir.NewFunc(r.pos())
|
||||
name.Func.Nname = name
|
||||
|
||||
if r.hasTypeParams() {
|
||||
name.Func.SetDupok(true)
|
||||
}
|
||||
|
||||
rext.funcExt(name)
|
||||
return name
|
||||
|
||||
@ -790,6 +794,10 @@ func (r *reader) method(rext *reader) *types.Field {
|
||||
name.Func = ir.NewFunc(r.pos())
|
||||
name.Func.Nname = name
|
||||
|
||||
if r.hasTypeParams() {
|
||||
name.Func.SetDupok(true)
|
||||
}
|
||||
|
||||
rext.funcExt(name)
|
||||
|
||||
meth := types.NewField(name.Func.Pos(), sym, typ)
|
||||
|
Loading…
Reference in New Issue
Block a user