]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/gc: eliminate redundant &x.Field nil checks
authorRuss Cox <rsc@golang.org>
Tue, 17 Sep 2013 20:54:22 +0000 (16:54 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 17 Sep 2013 20:54:22 +0000 (16:54 -0400)
commitaa0439ba65bfa762c26a3dbb3f0c0474267b5582
tree8bf2670a6b2611ffc776d0c8a2ea3ed704fcc0c6
parenteef7035ec860a2a8eac39ed3f4c0cb2a384599a2
cmd/gc: eliminate redundant &x.Field nil checks

This eliminates ~75% of the nil checks being emitted,
on all architectures. We can do better, but we need
a bit more general support from the compiler, and
I don't want to do that so close to Go 1.2.
What's here is simple but effective and safe.

A few small code generation cleanups were required
to make the analysis consistent on all systems about
which nil checks are omitted, at least in the test.

Fixes #6019.

R=ken2
CC=golang-dev
https://golang.org/cl/13334052
16 files changed:
src/cmd/5g/ggen.c
src/cmd/5g/peep.c
src/cmd/5g/prog.c
src/cmd/5g/reg.c
src/cmd/6g/cgen.c
src/cmd/6g/ggen.c
src/cmd/6g/peep.c
src/cmd/8g/cgen.c
src/cmd/8g/ggen.c
src/cmd/8g/peep.c
src/cmd/gc/gen.c
src/cmd/gc/pgen.c
src/cmd/gc/popt.c
src/cmd/gc/popt.h
src/cmd/gc/walk.c
test/nilptr3.go [new file with mode: 0644]