[llvm] r325394 - [X86] In lowerVSELECTtoVectorShuffle, don't map undef select condition to undef in shuffle mask.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 16 13:36:29 PST 2018
Author: ctopper
Date: Fri Feb 16 13:36:29 2018
New Revision: 325394
URL: http://llvm.org/viewvc/llvm-project?rev=325394&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=325394&r1=325393&r2=325394&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Feb 16 13:36:29 2018
@@ -14745,9 +14745,12 @@ static SDValue lowerVSELECTtoVectorShuff
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);
}
More information about the llvm-commits
mailing list