]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/gc: handle array slice self-assign in esc.go
authorIskander Sharipov <iskander.sharipov@intel.com>
Tue, 4 Sep 2018 20:14:53 +0000 (23:14 +0300)
committerIskander Sharipov <iskander.sharipov@intel.com>
Mon, 17 Sep 2018 11:14:58 +0000 (11:14 +0000)
commit859cf7fc0f4535ab3cdec15c81860f5fd2ae5b01
tree0a00a3b061ea264bc206c8174529a608b888bb7f
parent2d82465d18520820c52fea6b5e400a692ffdb92a
cmd/compile/internal/gc: handle array slice self-assign in esc.go

Instead of skipping all OSLICEARR, skip only ones with non-pointer
array type. For pointers to arrays, it's safe to apply the
self-assignment slicing optimizations.

Refactored the matching code into separate function for readability.

This is an extension to already existing optimization.

On its own, it does not improve any code under std, but
it opens some new optimization opportunities. One
of them is described in the referenced issue.

Updates #7921

Change-Id: I08ac660d3ef80eb15fd7933fb73cf53ded9333ad
Reviewed-on: https://go-review.googlesource.com/133375
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/gc/esc.go
test/escape2.go
test/escape2n.go