Skip to content

Commit 8216414

Browse files
committed
[X86] Address post-commit review from code I accidentally commited in r373136.
See https://reviews.llvm.org/D68167 llvm-svn: 373245
1 parent f0ca10f commit 8216414

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43479,16 +43479,19 @@ static SDValue combineAdd(SDNode *N, SelectionDAG &DAG,
4347943479
// FIXME: We have the (sub Y, (zext (vXi1 X))) -> (add (sext (vXi1 X)), Y) in
4348043480
// generic DAG combine without a legal type check, but adding this there
4348143481
// caused regressions.
43482-
if (Subtarget.hasAVX512() && VT.isVector()) {
43482+
if (VT.isVector()) {
43483+
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
4348343484
if (Op0.getOpcode() == ISD::ZERO_EXTEND &&
43484-
Op0.getOperand(0).getValueType().getVectorElementType() == MVT::i1) {
43485+
Op0.getOperand(0).getValueType().getVectorElementType() == MVT::i1 &&
43486+
TLI.isTypeLegal(Op0.getOperand(0).getValueType())) {
4348543487
SDLoc DL(N);
4348643488
SDValue SExt = DAG.getNode(ISD::SIGN_EXTEND, DL, VT, Op0.getOperand(0));
4348743489
return DAG.getNode(ISD::SUB, DL, VT, Op1, SExt);
4348843490
}
4348943491

4349043492
if (Op1.getOpcode() == ISD::ZERO_EXTEND &&
43491-
Op1.getOperand(0).getValueType().getVectorElementType() == MVT::i1) {
43493+
Op1.getOperand(0).getValueType().getVectorElementType() == MVT::i1 &&
43494+
TLI.isTypeLegal(Op1.getOperand(0).getValueType())) {
4349243495
SDLoc DL(N);
4349343496
SDValue SExt = DAG.getNode(ISD::SIGN_EXTEND, DL, VT, Op1.getOperand(0));
4349443497
return DAG.getNode(ISD::SUB, DL, VT, Op0, SExt);

0 commit comments

Comments
 (0)