compiler: avoid copy for string([]byte) conversion used in string concatenation
authorCherry Zhang <cherryyz@google.com>
Tue, 18 Jun 2019 23:55:50 +0000 (23:55 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 18 Jun 2019 23:55:50 +0000 (23:55 +0000)
commit864fcf61a00fa1b73ae32be6f1ee11a6f7362b82
tree251712aed0fe7f6df1a7e269149d6854d66555cc
parented920373a5faece7ea0bfdfebbd615294165c01c
compiler: avoid copy for string([]byte) conversion used in string concatenation

    If a string([]byte) conversion is used immediately in a string
    concatenation, we don't need to copy the backing store of the
    byte slice, as the runtime function doesn't hold any reference
    to it.

    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/182437

* go.dg/concatstring.go: New test.

From-SVN: r272460
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc
gcc/testsuite/ChangeLog
gcc/testsuite/go.dg/concatstring.go [new file with mode: 0644]