[X86] Memory folding for commutative instructions.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 12 Oct 2014 10:52:55 +0000 (10:52 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 12 Oct 2014 10:52:55 +0000 (10:52 +0000)
commitc00cd8e3c897c59b57443c76928d07645b553b93
treefa31e2cbe04c8da5c15bd72c2079003a8144ec1d
parent05f7e38c0bb8ff1cdb6546a4a991b2c8793264cf
[X86] Memory folding for commutative instructions.

This patch improves support for commutative instructions in the x86 memory folding implementation by attempting to fold a commuted version of the instruction if the original folding fails - if that folding fails as well the instruction is 're-commuted' back to its original order before returning.

This mainly helps the stack inliner better fold reloads of 3 (or more) operand instructions (VEX encoded SSE etc.) but by performing this in the lowest foldMemoryOperandImpl implementation it also replaces the X86InstrInfo::optimizeLoadInstr version and is now used by FastISel too.

Differential Revision: http://reviews.llvm.org/D5701

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219584 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86FastISel.cpp
lib/Target/X86/X86InstrInfo.cpp
lib/Target/X86/X86InstrInfo.h
test/CodeGen/X86/avx1-stack-reload-folding.ll [new file with mode: 0644]