X86 memcpy lowering: use "rep movs" even when esi is used as base pointer
authorHans Wennborg <hans@hanshq.net>
Tue, 18 Mar 2014 20:04:34 +0000 (20:04 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 18 Mar 2014 20:04:34 +0000 (20:04 +0000)
commit523f800e90f21861a5b6bb9f7c432c8799168bde
treeb2894a46095eb1dde65307e5e09f8318c6330c14
parent172c31844b3b8216313bcb7b7e20ad8ecbc71d5f
X86 memcpy lowering: use "rep movs" even when esi is used as base pointer

For functions where esi is used as base pointer, we would previously fall back
from lowering memcpy with "rep movs" because that clobbers esi.

With this patch, we just store esi in another physical register, and restore
it afterwards. This adds a little bit of register preassure, but the more
efficient memcpy should be worth it.

Differential Revision: http://llvm-reviews.chandlerc.com/D2968

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204174 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86SelectionDAGInfo.cpp
test/CodeGen/X86/inline-asm-sp-clobber-memcpy.ll
test/CodeGen/X86/stack-align-memcpy.ll