mirror of
https://github.com/golang/go
synced 2024-10-14 11:53:56 +00:00
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:
parent
03631f027e
commit
5af4b34870
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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++
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue