• Josh Bleecher Snyder's avatar
    cmd/compile: optimize more pointer comparisons · b8cbcaca
    Josh Bleecher Snyder authored
    The existing pointer comparison optimizations
    don't include pointer arithmetic. Add them.
    
    These rules trigger a few times in std cmd, while compiling:
    
    time.Duration.String
    cmd/go/internal/tlog.NodeHash
    crypto/tls.ticketKeyFromBytes (3 times)
    crypto/elliptic.(*p256Point).p256ScalarMult (15 times!)
    crypto/elliptic.initTable
    
    These weird comparisons occur when using the copy builtin,
    which does a pointer comparison between src and dst.
    
    This also happens to fix #32454, by optimizing enough
    early on that all values can be eliminated.
    
    Fixes #32454
    
    Change-Id: I799d45743350bddd15a295dc1e12f8d03c11d1c6
    Reviewed-on: https://go-review.googlesource.com/c/go/+/180940
    Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarKeith Randall <khr@golang.org>
    b8cbcaca
generic.rules 105 KB