]> Cypherpunks repositories - gostls13.git/commit
[dev.ssa] cmd/compile/ssa: add nilcheckelim pass
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 3 Jun 2015 19:31:47 +0000 (12:31 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Wed, 24 Jun 2015 19:56:51 +0000 (19:56 +0000)
commit2a846d2bd36a74d971ad6d009a05d2ca64bba8a9
treef8ecf6598af7cb40ca6e7d5e84bd6c98ac2db5ce
parent8c6abfeacb27f1bcce8fb01f7da95950590943e3
[dev.ssa] cmd/compile/ssa: add nilcheckelim pass

The nilcheckelim pass eliminates unnecessary nil checks.
The initial implementation removes redundant nil checks.
See the comments in nilcheck.go for ideas for future
improvements.

The efficacy of the cse pass has a significant impact
on this efficacy of this pass.

There are 886 nil checks in the parts of the standard
library that SSA can currently compile (~20%).

This pass eliminates 75 (~8.5%) of them.

As a data point, with a more aggressive but unsound
cse pass that treats many more types as identical,
this pass eliminates 115 (~13%) of the nil checks.

Change-Id: I13e567a39f5f6909fc33434d55c17a7e3884a704
Reviewed-on: https://go-review.googlesource.com/11430
Reviewed-by: Alan Donovan <adonovan@google.com>
src/cmd/compile/internal/ssa/TODO
src/cmd/compile/internal/ssa/compile.go
src/cmd/compile/internal/ssa/cse.go
src/cmd/compile/internal/ssa/nilcheck.go [new file with mode: 0644]