]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: move IsDeadcodeClosure check into enqueueFunc
authorMatthew Dempsky <mdempsky@google.com>
Fri, 11 Aug 2023 22:16:12 +0000 (15:16 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 14 Aug 2023 18:39:58 +0000 (18:39 +0000)
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>
src/cmd/compile/internal/gc/compile.go
src/cmd/compile/internal/gc/main.go

index 4795297e7e3280a573126220867b2c583ed89cdf..47cc71df1e2e6df949592152c05f3651c3d1ac06 100644 (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
        }
index 94043719aa77510414461072cab807dd6b77bd78..4d2850436089a8ac1ee6fa6769ed52ba07910ae4 100644 (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++
        }