From: Matthew Dempsky Date: Fri, 11 Aug 2023 22:16:12 +0000 (-0700) Subject: cmd/compile: move IsDeadcodeClosure check into enqueueFunc X-Git-Tag: go1.22rc1~1309 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5af4b3487011f8e88accf06131c3f6e64e58cb2a;p=gostls13.git cmd/compile: move IsDeadcodeClosure check into enqueueFunc Keeps the top-level loop in Main slightly cleaner. Change-Id: I9c8d38d4bbb34d53edc0796893534763e9eef2f1 Reviewed-on: https://go-review.googlesource.com/c/go/+/518957 Run-TryBot: Matthew Dempsky Auto-Submit: Matthew Dempsky TryBot-Result: Gopher Robot Reviewed-by: Cuong Manh Le Reviewed-by: Than McIntosh --- diff --git a/src/cmd/compile/internal/gc/compile.go b/src/cmd/compile/internal/gc/compile.go index 4795297e7e..47cc71df1e 100644 --- a/src/cmd/compile/internal/gc/compile.go +++ b/src/cmd/compile/internal/gc/compile.go @@ -39,6 +39,11 @@ func enqueueFunc(fn *ir.Func) { return } + // Don't try compiling dead hidden closure. + if fn.IsDeadcodeClosure() { + return + } + if clo := fn.OClosure; clo != nil && !ir.IsTrivialClosure(clo) { return // we'll get this as part of its enclosing function } diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index 94043719aa..4d28504360 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -304,10 +304,6 @@ func Main(archInit func(*ssagen.ArchInfo)) { fcount := int64(0) for i := 0; i < len(typecheck.Target.Funcs); i++ { fn := typecheck.Target.Funcs[i] - // Don't try compiling dead hidden closure. - if fn.IsDeadcodeClosure() { - continue - } enqueueFunc(fn) fcount++ }