[PATCH] Move memset value into register

Serge Pavlov sepavloff at gmail.com
Thu Aug 22 22:40:27 PDT 2013


sepavloff added you to the CC list for the revision "Move memset value into register".

This patch fixes PR5124 (memset inline-code threshold dubiously high).
If memset is expanded inline and the memset value is constant, code generator created sequence of instructions 'mov imm, mem', like:

        movl   $0x0,0x4(%esi)
        movl   $0x0,0x8(%esi)

With this patch the memset value is put into register and then instructions 'mov reg, mem' are used:

        movl   %eax,0x4(%esi)
        movl   %eax,0x8(%esi)

It is profitable for both speed and code size, gcc and icc expand memset in this way.

Please review the patch. Thank you.

http://llvm-reviews.chandlerc.com/D1484

Files:
  include/llvm/Target/TargetLowering.h
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86ISelLowering.h
  test/CodeGen/X86/memset-sse-stack-realignment.ll
  test/CodeGen/X86/memset.ll
  test/CodeGen/X86/tlv-1.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1484.1.patch
Type: text/x-patch
Size: 8077 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130822/5d65831d/attachment.bin>


More information about the llvm-commits mailing list