forked from OSchip/llvm-project
[X86] In lowerVSELECTtoVectorShuffle, don't map undef select condition to undef in shuffle mask.
Undef in select condition means we should pick the element from one side or the other. An undef in a shuffle mask means pick any element from either source or worse. I suspect by the time we get here most of the undefs in a constant vector have been removed by other things, but doing this for safety. llvm-svn: 325394
This commit is contained in:
parent
331f97e171
commit
27b9ac2372
|
@ -14745,9 +14745,12 @@ static SDValue lowerVSELECTtoVectorShuffle(SDValue Op,
|
|||
SmallVector<int, 32> Mask;
|
||||
for (int i = 0, Size = VT.getVectorNumElements(); i < Size; ++i) {
|
||||
SDValue CondElt = CondBV->getOperand(i);
|
||||
Mask.push_back(
|
||||
isa<ConstantSDNode>(CondElt) ? i + (isNullConstant(CondElt) ? Size : 0)
|
||||
: -1);
|
||||
int M = i;
|
||||
// We can't map undef to undef here. They have different meanings. Treat
|
||||
// as the same as zero.
|
||||
if (CondElt.isUndef() || isNullConstant(CondElt))
|
||||
M += Size;
|
||||
Mask.push_back(M);
|
||||
}
|
||||
return DAG.getVectorShuffle(VT, dl, LHS, RHS, Mask);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue