diff options
author | Cherry Zhang <cherryyz@google.com> | 2019-05-09 21:24:56 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-05-09 21:24:56 +0000 |
commit | 8743680541b8aeefdecba01b1960509a8d184202 (patch) | |
tree | 6e0408b38efa777cfebe66ec1eadb2781cb07cc3 /gcc/fortran/trans-array.c | |
parent | 08e113f4aea9b3e80ffc1365ebd9db8ceedf8797 (diff) | |
download | gcc-8743680541b8aeefdecba01b1960509a8d184202.zip gcc-8743680541b8aeefdecba01b1960509a8d184202.tar.gz gcc-8743680541b8aeefdecba01b1960509a8d184202.tar.bz2 |
compiler: avoid copy for string([]byte) conversion used in map keys
If a string([]byte) conversion is used immediately as a key for a
map read, we don't need to copy the backing store of the byte
slice, as mapaccess does not keep a reference to it.
The gc compiler does more than this: it also avoids the copy if
the map key is a composite literal that contains the conversion
as a field, like, T{ ... { ..., string(b), ... }, ... }. For now,
we just optimize the simple case, which is probably most common.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/176197
* go.dg/mapstring.go: New test.
From-SVN: r271044
Diffstat (limited to 'gcc/fortran/trans-array.c')
0 files changed, 0 insertions, 0 deletions