]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: disable checknils during alg eq generation
authorJosh Bleecher Snyder <josharian@gmail.com>
Tue, 5 May 2015 01:16:50 +0000 (18:16 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 22 Feb 2016 21:10:55 +0000 (21:10 +0000)
Cuts 20k off cmd/go and 32k off golang.org/x/tools/cmd/godoc, approx 0.15% each.

For #6853 and #9930

Change-Id: Ic510b76b80a9153b1ede7b3533d2dbc16caa5c63
Reviewed-on: https://go-review.googlesource.com/19768
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
src/cmd/compile/internal/gc/subr.go

index f48b7cdc4f96fb7bae6dc2799ff123c0251fef97..bda1c951379c444d34acc687859f733d635bd096 100644 (file)
@@ -2862,10 +2862,18 @@ func geneq(sym *Sym, t *Type) {
        // for a struct containing a reflect.Value, which itself has
        // an unexported field of type unsafe.Pointer.
        old_safemode := safemode
-
        safemode = 0
+
+       // Disable checknils while compiling this code.
+       // We are comparing a struct or an array,
+       // neither of which can be nil, and our comparisons
+       // are shallow.
+       Disable_checknil++
+
        funccompile(fn)
+
        safemode = old_safemode
+       Disable_checknil--
 }
 
 func ifacelookdot(s *Sym, t *Type, followptr *bool, ignorecase int) *Type {