diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-02-15 01:54:51 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-02-15 01:54:51 +0000 |
commit | c080d6fb3dc7769c5a1e00c6a77cb415453b0b89 (patch) | |
tree | 7004188b0b3bdee1109fdd5b0ac66d02b5813a36 | |
parent | 6d9d13d2e493250b62fdf9812058a7a4dbcc6513 (diff) | |
download | external_llvm-c080d6fb3dc7769c5a1e00c6a77cb415453b0b89.zip external_llvm-c080d6fb3dc7769c5a1e00c6a77cb415453b0b89.tar.gz external_llvm-c080d6fb3dc7769c5a1e00c6a77cb415453b0b89.tar.bz2 |
Lower memcpy with small constant size operand into a series of load / store
ops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26195 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 8caa5c3..0c52eda 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -1641,19 +1641,45 @@ void SelectionDAGLowering::visitMemIntrinsic(CallInst &I, unsigned Op) { MVT::ValueType VT = MemOps[i]; unsigned VTSize = getSizeInBits(VT) / 8; SDOperand Value = getMemsetValue(Op2, VT, DAG); - OutChains. - push_back(DAG.getNode(ISD::STORE, MVT::Other, getRoot(), - Value, - getMemBasePlusOffset(Op1, Offset, DAG, TLI), - DAG.getSrcValue(NULL))); + SDOperand Store = DAG.getNode(ISD::STORE, MVT::Other, getRoot(), + Value, + getMemBasePlusOffset(Op1, Offset, DAG, TLI), + DAG.getSrcValue(I.getOperand(1), Offset)); + OutChains.push_back(Store); + Offset += VTSize; + } + } + break; + } + case ISD::MEMCPY: { + if (MeetsMaxMemopRequirement(MemOps, TLI.getMaxStoresPerMemcpy(), + Size->getValue(), Align, TLI)) { + unsigned NumMemOps = MemOps.size(); + unsigned Offset = 0; + for (unsigned i = 0; i < NumMemOps; i++) { + MVT::ValueType VT = MemOps[i]; + unsigned VTSize = getSizeInBits(VT) / 8; + SDOperand Value = + DAG.getLoad(VT, getRoot(), + getMemBasePlusOffset(Op2, Offset, DAG, TLI), + DAG.getSrcValue(I.getOperand(2), Offset)); + SDOperand Store = + DAG.getNode(ISD::STORE, MVT::Other, Value.getValue(1), + Value, + getMemBasePlusOffset(Op1, Offset, DAG, TLI), + DAG.getSrcValue(I.getOperand(1), Offset)); + OutChains.push_back(Store); Offset += VTSize; } - - DAG.setRoot(DAG.getNode(ISD::TokenFactor, MVT::Other, OutChains)); - return; } + break; } } + + if (!OutChains.empty()) { + DAG.setRoot(DAG.getNode(ISD::TokenFactor, MVT::Other, OutChains)); + return; + } } std::vector<SDOperand> Ops; |