diff options
author | Cherry Zhang <cherryyz@google.com> | 2019-05-08 23:06:52 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-05-08 23:06:52 +0000 |
commit | 3407d1658f7d60cfb78293d61dfc21258efb0074 (patch) | |
tree | 8aab6b19727ef793d37cb592a45bd808a3419700 /gcc/c | |
parent | 8238b660fb6204b3e6968e9a6ed550b16c86b25e (diff) | |
download | gcc-3407d1658f7d60cfb78293d61dfc21258efb0074.zip gcc-3407d1658f7d60cfb78293d61dfc21258efb0074.tar.gz gcc-3407d1658f7d60cfb78293d61dfc21258efb0074.tar.bz2 |
compiler: avoid copy for string([]byte) conversion used in string comparison
If a string([]byte) conversion is used immediately in a string
comparison, we don't need to copy the backing store of the byte
slice, as the string comparison doesn't hold any reference to
it. Instead, just create a string header from the byte slice and
pass it for comparison.
A new type of expression, String_value_expression, is introduced,
for constructing string headers.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/170894
* go.dg/cmpstring.go: New test.
From-SVN: r271021
Diffstat (limited to 'gcc/c')
0 files changed, 0 insertions, 0 deletions