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 <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Matthew Dempsky 2023-08-11 15:16:12 -07:00 committed by Gopher Robot
parent 03631f027e
commit 5af4b34870
2 changed files with 5 additions and 4 deletions

View file

@ -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
}

View file

@ -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++
}