From 9944ba757b0f8005cfb7715d41592c7e13c0a2b8 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Mon, 17 Oct 2022 16:57:07 -0700 Subject: cmd/compile: fix transitive inlining of generic functions If an imported, non-generic function F transitively calls a generic function G[T], we may need to call CanInline on G[T]. While here, we can also take advantage of the fact that we know G[T] was already seen and compiled in an imported package, so we don't need to call InlineCalls or add it to typecheck.Target.Decls. This saves us from wasting compile time re-creating DUPOK symbols that we know already exist in the imported package's link objects. Fixes #56280. Change-Id: I3336786bee01616ee9f2b18908738e4ca41c8102 Reviewed-on: https://go-review.googlesource.com/c/go/+/443535 Run-TryBot: Matthew Dempsky TryBot-Result: Gopher Robot Reviewed-by: David Chase Auto-Submit: Matthew Dempsky --- src/cmd/compile/internal/noder/reader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cmd/compile/internal/noder/reader.go') diff --git a/src/cmd/compile/internal/noder/reader.go b/src/cmd/compile/internal/noder/reader.go index fe90f52b4d..d03da27a46 100644 --- a/src/cmd/compile/internal/noder/reader.go +++ b/src/cmd/compile/internal/noder/reader.go @@ -3485,7 +3485,7 @@ func unifiedInlineCall(call *ir.CallExpr, fn *ir.Func, inlIndex int) *ir.Inlined // potentially be recursively inlined themselves; but we shouldn't // need to read in the non-inlined bodies for the declarations // themselves. But currently it's an easy fix to #50552. - readBodies(typecheck.Target) + readBodies(typecheck.Target, true) deadcode.Func(r.curfn) -- cgit v1.3-5-g9baa