[X86] getTargetConstantBitsFromNode - fix self-move assertions from gcc builds due to rL343375

llvm-svn: 343377
This commit is contained in:
Simon Pilgrim 2018-09-29 14:51:09 +00:00
parent 43e4e648ef
commit a731940c60
1 changed files with 6 additions and 2 deletions

View File

@ -5748,11 +5748,15 @@ static bool getTargetConstantBitsFromNode(SDValue Op, unsigned EltSizeInBits,
if (getTargetConstantBitsFromNode(Op.getOperand(0), EltSizeInBits,
UndefElts, EltBits, AllowWholeUndefs,
AllowPartialUndefs)) {
EVT SrcVT = Op.getOperand(0).getValueType();
unsigned NumSrcElts = SrcVT.getVectorNumElements();
unsigned NumSubElts = VT.getVectorNumElements();
unsigned BaseIdx = Op.getConstantOperandVal(1);
UndefElts = UndefElts.extractBits(NumSubElts, BaseIdx);
EltBits.erase(EltBits.begin() + BaseIdx + NumSubElts, EltBits.end());
EltBits.erase(EltBits.begin(), EltBits.begin() + BaseIdx);
if ((BaseIdx + NumSubElts) != NumSrcElts)
EltBits.erase(EltBits.begin() + BaseIdx + NumSubElts, EltBits.end());
if (BaseIdx != 0)
EltBits.erase(EltBits.begin(), EltBits.begin() + BaseIdx);
return true;
}
}