]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/ssa: recognize constant pointer comparison
authorphilhofer <phofer@umich.edu>
Wed, 15 Mar 2017 22:34:52 +0000 (15:34 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 20 Mar 2017 21:04:44 +0000 (21:04 +0000)
commitd68bb16b1e2f2fb55b347bdb6d1374103b5cb6a0
tree06175850b8abdf43fba38b6461aa11afbacde0ff
parentf8b0231639859de7b8f1bfe7df1be0132aec9ad6
cmd/compile/internal/ssa: recognize constant pointer comparison

Teach the backend to recognize that the address of a symbol
is equal with itself, and that the addresses of two different
symbols are different.

Some examples of where this rule hits in the standard library:

 - inlined uses of (*time.Time).setLoc (e.g. time.UTC)
 - inlined uses of bufio.NewReader (via type assertion)

Change-Id: I23dcb068c2ec333655c1292917bec13bbd908c24
Reviewed-on: https://go-review.googlesource.com/38338
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
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/gc/ssa.go
src/cmd/compile/internal/ssa/gen/generic.rules
src/cmd/compile/internal/ssa/rewritegeneric.go