diff options
author | Dan Gohman <gohman@apple.com> | 2009-09-23 01:29:41 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-09-23 01:29:41 +0000 |
commit | 00133a7d52f32ab9c9ac53e964a5cc68fc626b4d (patch) | |
tree | 42a4b05721629d2e4a2882e42050bf39bfac31c1 | |
parent | d75e9aad24723cf816d3b3cf658bbd23da144f90 (diff) |
Fix X86's unfoldMemoryOperand to properly handle MachineMemOperands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82597 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/X86InstrInfo.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index e55aa1e9bb..fb26c5ce4e 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -2567,7 +2567,7 @@ X86InstrInfo::unfoldMemoryOperand(SelectionDAG &DAG, SDNode *N, std::vector<SDValue> AfterOps; DebugLoc dl = N->getDebugLoc(); unsigned NumOps = N->getNumOperands(); - for (unsigned i = 0; i != NumOps-1; ++i) { + for (unsigned i = 0; i != NumOps-2; ++i) { SDValue Op = N->getOperand(i); if (i >= Index-NumDefs && i < Index-NumDefs + X86AddrNumOperands) AddrOps.push_back(Op); @@ -2576,6 +2576,8 @@ X86InstrInfo::unfoldMemoryOperand(SelectionDAG &DAG, SDNode *N, else if (i > Index-NumDefs) AfterOps.push_back(Op); } + SDValue MemOp = N->getOperand(NumOps-2); + AddrOps.push_back(MemOp); SDValue Chain = N->getOperand(NumOps-1); AddrOps.push_back(Chain); @@ -2613,7 +2615,9 @@ X86InstrInfo::unfoldMemoryOperand(SelectionDAG &DAG, SDNode *N, // Emit the store instruction. if (FoldedStore) { AddrOps.pop_back(); + AddrOps.pop_back(); AddrOps.push_back(SDValue(NewNode, 0)); + AddrOps.push_back(MemOp); AddrOps.push_back(Chain); bool isAligned = (RI.getStackAlignment() >= 16) || RI.needsStackRealignment(MF); |