[PATCH] [X86] New pass that moves immediate operands to registers.

Serge Pavlov sepavloff at gmail.com
Tue Sep 30 10:24:33 PDT 2014


The pass scans machine instructions looking for uses of immediate
values. If the same value is used in neighbouring instructions, it
is moved to a register, if this is possible and reduces code size.
For instance, instructions

    mov $0, 0x4(%esi)
    mov $0, 0x8(%esi)

can be replaced by

    mov $0, %eax
    mov %eax, 0x4(%esi)
    mov %eax, 0x8(%esi)

which is shorter in code size.

This patch fixes PR5124, it uses feedback on the previous patch discussed in the thread
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130916/188079.html .

http://reviews.llvm.org/D5544

Files:
  lib/Target/X86/CMakeLists.txt
  lib/Target/X86/X86.h
  lib/Target/X86/X86MaterializeImmediates.cpp
  lib/Target/X86/X86TargetMachine.cpp
  test/CodeGen/X86/coalescer-commute3.ll
  test/CodeGen/X86/fast-isel-x86.ll
  test/CodeGen/X86/materialize-imm.ll
  test/CodeGen/X86/memcpy-2.ll
  test/CodeGen/X86/memset.ll
  test/CodeGen/X86/memset64-on-x86-32.ll
  test/CodeGen/X86/nancvt.ll
  test/CodeGen/X86/pr14562.ll
  test/CodeGen/X86/pr18023.ll
  test/CodeGen/X86/tlv-1.ll
  test/CodeGen/X86/xmulo.ll
  test/DebugInfo/X86/debug-loc-offset.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5544.14236.patch
Type: text/x-patch
Size: 62372 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140930/e8df8534/attachment.bin>


More information about the llvm-commits mailing list