]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: optimize more pointer comparisons
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 6 Jun 2019 18:40:47 +0000 (11:40 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 29 Aug 2019 19:35:18 +0000 (19:35 +0000)
commitb8cbcacabe4fecab9122e04cdc71e7f2649e9981
tree70f16d35b961e9498ad3d62e5de45768d61aa719
parentabda0a6a92749656621acba5bbda6a6f2450718d
cmd/compile: optimize more pointer comparisons

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: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/gen/generic.rules
src/cmd/compile/internal/ssa/rewritegeneric.go
test/fixedbugs/issue32454.go [new file with mode: 0644]