Don't bother storing undef elements of BUILD_VECTOR's

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26858 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-03-19 05:46:04 +00:00
parent a17409dfd6
commit 74881908fe

View File

@ -794,6 +794,9 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
unsigned VectorSize = MVT::getSizeInBits(VT)/8;
// Store (in the right endianness) the elements to memory.
for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i) {
// Ignore undef elements.
if (Node->getOperand(i).getOpcode() == ISD::UNDEF) continue;
unsigned Offset;
if (isLittleEndian)
Offset = TypeByteSize*i;
@ -807,7 +810,12 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
Node->getOperand(i), Idx,
DAG.getSrcValue(NULL)));
}
SDOperand StoreChain = DAG.getNode(ISD::TokenFactor, MVT::Other, Stores);
SDOperand StoreChain;
if (!Stores.empty()) // Not all undef elements?
StoreChain = DAG.getNode(ISD::TokenFactor, MVT::Other, Stores);
else
StoreChain = DAG.getEntryNode();
// Result is a load from the stack slot.
Result = DAG.getLoad(VT, StoreChain, FIPtr, DAG.getSrcValue(0));