]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/ssa: handle symbol address comparisons consistently
authorBryan Chan <bryanpkc@gmail.com>
Fri, 23 Mar 2018 08:14:25 +0000 (04:14 -0400)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sat, 31 Mar 2018 21:37:13 +0000 (21:37 +0000)
commit625f2dccd4593d709f98e6411e9bee9f195b5c61
treecbc48bba199ef9b5de6a926917bacd7628e25b47
parentec60e4a0d2ddabd7667fd9bff9f376e6a181ce8d
cmd/compile/internal/ssa: handle symbol address comparisons consistently

CL 38338 introduced SSA rules to optimize two types of pointer equality
tests: a pointer compared with itself, and comparison of addresses taken
of two symbols which may have the same base. This patch adds rules to
apply the same optimization to pointer inequality tests, which also ensures
that two pointers to zero-width types cannot be both equal and unequal
at the same time.

Fixes #24503.

Change-Id: Ic828aeb86ae2e680caf66c35f4c247674768a9ba
Reviewed-on: https://go-review.googlesource.com/102275
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/ssa/gen/generic.rules
src/cmd/compile/internal/ssa/rewritegeneric.go
test/fixedbugs/issue24503.go [new file with mode: 0644]