]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: convert memmove call into Move when arguments are disjoint
authorMichael Munday <mike.munday@ibm.com>
Sun, 29 Apr 2018 14:12:50 +0000 (15:12 +0100)
committerMichael Munday <mike.munday@ibm.com>
Wed, 9 May 2018 11:20:40 +0000 (11:20 +0000)
commit6d00e8c478431b32b38ac5849a703a86df8e5298
tree54a68f6a7d6ca643e0b1cf379ccd8cf6458236db
parent66cb80c266a83313abadbd004b5358c1d1761ed3
cmd/compile: convert memmove call into Move when arguments are disjoint

Move ops can be faster than memmove calls because the number of bytes
to be moved is fixed and they don't incur the overhead of a call.
This change allows memmove to be converted into a Move op when the
arguments are disjoint.

The optimization is only enabled on s390x at the moment, however
other architectures may also benefit from it in the future. The
memmove inlining rule triggers an extra 12 times when compiling the
standard library. It will most likely make more of a difference as the
disjoint function is improved over time (to recognize fresh heap
allocations for example).

Change-Id: I9af570dcfff28257b8e59e0ff584a46d8e248310
Reviewed-on: https://go-review.googlesource.com/110064
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
src/cmd/compile/internal/ssa/gen/generic.rules
src/cmd/compile/internal/ssa/rewrite.go
src/cmd/compile/internal/ssa/rewritegeneric.go
test/codegen/copy.go