compiler: generate memmove for non-pointer slice copy
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 8 May 2019 20:08:32 +0000 (20:08 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 8 May 2019 20:08:32 +0000 (20:08 +0000)
commit8ba2bda8e4b4276770901b720dee4f3d297dda3c
treeb09cebba2ae3f1765d776aeb1ec2af5bbfa25a62
parentfbe4e644c0c8f1303ec91a25b8da6e626976500c
compiler: generate memmove for non-pointer slice copy

    The builtin copy function is lowered to runtime functions
    slicecopy, stringslicecopy, or typedslicecopy. The first two are
    basically thin wrappers of memmove. Instead of making a runtime
    call, we can just use __builtin_memmove. This gives the compiler
    backend opportunities for further optimizations.

    Move the lowering of builtin copy function to flatten phase for
    the ease of rewriting.

    Also do this optimization for the copy part of append(s1, s2...).

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

From-SVN: r271017
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/runtime.def