diff options
author | Andrew Trick <atrick@apple.com> | 2013-11-12 18:06:12 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2013-11-12 18:06:12 +0000 |
commit | 0085d5e5ae45e74254c2aa682e18574cd79f3455 (patch) | |
tree | 14dc73e28af7cc34ac7e1119d91d4b5d9b154b25 /lib/Target/X86/X86InstrInfo.cpp | |
parent | 2f08e75a45b9fa698a49277f6cc11e041bf5fa51 (diff) | |
download | external_llvm-0085d5e5ae45e74254c2aa682e18574cd79f3455.zip external_llvm-0085d5e5ae45e74254c2aa682e18574cd79f3455.tar.gz external_llvm-0085d5e5ae45e74254c2aa682e18574cd79f3455.tar.bz2 |
Simplify operand folding when rematerializing a load.
We already know how to fold a reload from a frameindex without
analyzing the load instruction. Generalize this to handle any
frameindex load. This streamlines the logic for rematerializing loads
from stack arguments. As a side effect, it allows stackmaps to record
a stack argument location without spilling it.
Verified no effect on codegen for llvm test-suite.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194497 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86InstrInfo.cpp')
-rw-r--r-- | lib/Target/X86/X86InstrInfo.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index eda285b..75c6c2a 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -4292,6 +4292,12 @@ MachineInstr* X86InstrInfo::foldMemoryOperandImpl(MachineFunction &MF, MachineInstr *MI, const SmallVectorImpl<unsigned> &Ops, MachineInstr *LoadMI) const { + // If loading from a FrameIndex, fold directly from the FrameIndex. + unsigned NumOps = LoadMI->getDesc().getNumOperands(); + int FrameIndex; + if (isLoadFromStackSlot(LoadMI, FrameIndex)) + return foldMemoryOperandImpl(MF, MI, Ops, FrameIndex); + // Check switch flag if (NoFusing) return NULL; @@ -4417,7 +4423,6 @@ MachineInstr* X86InstrInfo::foldMemoryOperandImpl(MachineFunction &MF, return NULL; // Folding a normal load. Just copy the load's address operands. - unsigned NumOps = LoadMI->getDesc().getNumOperands(); for (unsigned i = NumOps - X86::AddrNumOperands; i != NumOps; ++i) MOs.push_back(LoadMI->getOperand(i)); break; |