Revert "X86 memcpy lowering: use "rep movs" even when esi is used as base pointer...
authorHans Wennborg <hans@hanshq.net>
Wed, 26 Mar 2014 16:30:54 +0000 (16:30 +0000)
committerHans Wennborg <hans@hanshq.net>
Wed, 26 Mar 2014 16:30:54 +0000 (16:30 +0000)
commitb82f8a28e8768d1acdb565adbda9ac8b241471a9
tree532aed4e28b01ee989a9c2dc948c5861d88136cb
parent7363d2223e09fd78094fba652223785f0d63c196
Revert "X86 memcpy lowering: use "rep movs" even when esi is used as base pointer" (r204174)

>  For functions where esi is used as base pointer, we would previously fall ba
>  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

This didn't work. I was ending up with code like this:

  lea     edi,[esi+38h]
  mov     ecx,0Fh
  mov     edx,esi
  mov     esi,ebx
  rep movs dword ptr es:[edi],dword ptr [esi]
  lea     ecx,[esi+74h] <-- Ooops, we're now using esi before restoring it from edx.
  add     ebx,3Ch
  mov     esi,edx

I guess if we want to do this we need stronger glue or something, or doing the expansion
much later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204829 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