]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: prune some deadcode around ODCLFUNC
authorMatthew Dempsky <mdempsky@google.com>
Fri, 18 Aug 2023 05:04:49 +0000 (22:04 -0700)
committerGopher Robot <gobot@golang.org>
Fri, 18 Aug 2023 22:37:59 +0000 (22:37 +0000)
An *ir.Func is always ODCLFUNC, so no need to double-check this
anymore. The type system statically ensures we have the right Op.

Also, pkginit.initRequiredForCoverage appears to be unused, so we can
get rid of it completely.

Change-Id: If1abb35672b40f705f23c365ad2a828c2661e9c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/520603
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/cmd/compile/internal/escape/escape.go
src/cmd/compile/internal/pkginit/init.go
src/cmd/compile/internal/ssagen/nowb.go

index 25136c242b90e5b88c57d3174dab9b7ffbf6d50f..f38bcadb3e1b73590f41e257d071a5c3fda4e192 100644 (file)
@@ -125,12 +125,6 @@ func Funcs(all []*ir.Func) {
 // Batch performs escape analysis on a minimal batch of
 // functions.
 func Batch(fns []*ir.Func, recursive bool) {
-       for _, fn := range fns {
-               if fn.Op() != ir.ODCLFUNC {
-                       base.Fatalf("unexpected node: %v", fn)
-               }
-       }
-
        var b batch
        b.heapLoc.attrs = attrEscapes | attrPersists | attrMutates | attrCalls
        b.mutatorLoc.attrs = attrMutates
index 7d2e4ce07637a1104bbc71b738df72c1317dfb05..3b7efba434550c9249704ffff2c755ff5ae74c03 100644 (file)
@@ -199,18 +199,3 @@ func MakeTask() {
        // It's not quite read only, the state field must be modifiable.
        objw.Global(lsym, int32(ot), obj.NOPTR)
 }
-
-// initRequiredForCoverage returns TRUE if we need to force creation
-// of an init function for the package so as to insert a coverage
-// runtime registration call.
-func initRequiredForCoverage(l []ir.Node) bool {
-       if base.Flag.Cfg.CoverageInfo == nil {
-               return false
-       }
-       for _, n := range l {
-               if n.Op() == ir.ODCLFUNC {
-                       return true
-               }
-       }
-       return false
-}
index 8a020611dfb47425d1f84879821ee67f35f96f6a..3ef0952eff0398721fcf97eb23798f8f206ad6b7 100644 (file)
@@ -98,9 +98,6 @@ func (c *nowritebarrierrecChecker) findExtraCalls(nn ir.Node) {
        default:
                base.Fatalf("expected ONAME or OCLOSURE node, got %+v", arg)
        }
-       if callee.Op() != ir.ODCLFUNC {
-               base.Fatalf("expected ODCLFUNC node, got %+v", callee)
-       }
        c.extraCalls[c.curfn] = append(c.extraCalls[c.curfn], nowritebarrierrecCall{callee, n.Pos()})
 }