Fix a crash when faced with a shuffle vector that has an undef in its mask.

llvm-svn: 27726
This commit is contained in:
Chris Lattner 2006-04-15 23:48:05 +00:00
parent 873202fabd
commit 24acbe46c0
1 changed files with 5 additions and 1 deletions

View File

@ -1116,7 +1116,11 @@ static SDOperand LowerVECTOR_SHUFFLE(SDOperand Op, SelectionDAG &DAG) {
std::vector<SDOperand> ResultMask;
for (unsigned i = 0, e = PermMask.getNumOperands(); i != e; ++i) {
unsigned SrcElt =cast<ConstantSDNode>(PermMask.getOperand(i))->getValue();
unsigned SrcElt;
if (PermMask.getOperand(i).getOpcode() == ISD::UNDEF)
SrcElt = 0;
else
SrcElt = cast<ConstantSDNode>(PermMask.getOperand(i))->getValue();
for (unsigned j = 0; j != BytesPerElement; ++j)
ResultMask.push_back(DAG.getConstant(SrcElt*BytesPerElement+j,