[llvm] 1fe6a8a - [X86] Use llvm::isOneConstant (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 22 00:25:24 PDT 2023
Author: Kazu Hirata
Date: 2023-03-22T00:25:13-07:00
New Revision: 1fe6a8a584fe7f377a61f56af57fc1f3e8b3f82a
URL: https://github.com/llvm/llvm-project/commit/1fe6a8a584fe7f377a61f56af57fc1f3e8b3f82a
DIFF: https://github.com/llvm/llvm-project/commit/1fe6a8a584fe7f377a61f56af57fc1f3e8b3f82a.diff
LOG: [X86] Use llvm::isOneConstant (NFC)
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index e9a069b7295e1..a491ba84bf705 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<ConstantSDNode>(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 &&
More information about the llvm-commits
mailing list