Fix BuildVectorSDNode::isConstantSplat to handle one-element vectors.

It is an error to call APInt::zext with a size that is equal to the value's
current size, so use zextOrTrunc instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66039 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bob Wilson 2009-03-04 17:47:01 +00:00
parent 675e754c61
commit d344b884dd

View File

@ -5583,9 +5583,9 @@ bool BuildVectorSDNode::isConstantSplat(APInt &SplatValue,
if (OpVal.getOpcode() == ISD::UNDEF)
SplatUndef |= APInt::getBitsSet(sz, BitPos, BitPos +EltBitSize);
else if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(OpVal))
SplatValue |= APInt(CN->getAPIntValue()).zext(sz) << BitPos;
SplatValue |= APInt(CN->getAPIntValue()).zextOrTrunc(sz) << BitPos;
else if (ConstantFPSDNode *CN = dyn_cast<ConstantFPSDNode>(OpVal))
SplatValue |= CN->getValueAPF().bitcastToAPInt().zext(sz) << BitPos;
SplatValue |= CN->getValueAPF().bitcastToAPInt().zextOrTrunc(sz) <<BitPos;
else
return false;
}