diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index e9a069b7295e..a491ba84bf70 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -56700,11 +56700,9 @@ static SDValue combineScalarToVector(SDNode *N, SelectionDAG &DAG) { // This occurs frequently in our masked scalar intrinsic code and our // floating point select lowering with AVX512. // TODO: SimplifyDemandedBits instead? - if (VT == MVT::v1i1 && Src.getOpcode() == ISD::AND && Src.hasOneUse()) - if (auto *C = dyn_cast(Src.getOperand(1))) - if (C->getAPIntValue().isOne()) - return DAG.getNode(ISD::SCALAR_TO_VECTOR, DL, MVT::v1i1, - Src.getOperand(0)); + if (VT == MVT::v1i1 && Src.getOpcode() == ISD::AND && Src.hasOneUse() && + isOneConstant(Src.getOperand(1))) + return DAG.getNode(ISD::SCALAR_TO_VECTOR, DL, MVT::v1i1, Src.getOperand(0)); // Combine scalar_to_vector of an extract_vector_elt into an extract_subvec. if (VT == MVT::v1i1 && Src.getOpcode() == ISD::EXTRACT_VECTOR_ELT &&