From: Kazu Hirata Date: Mon, 27 Mar 2023 06:34:13 +0000 (-0700) Subject: [Target] Use isNullConstant (NFC) X-Git-Tag: upstream/17.0.6~13621 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=62c38ffb15fac7c82dee83002ffd9267553fb534;p=platform%2Fupstream%2Fllvm.git [Target] Use isNullConstant (NFC) --- diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 0612304..521caad 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -16586,7 +16586,6 @@ performExtractVectorEltCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG = DCI.DAG; SDValue N0 = N->getOperand(0), N1 = N->getOperand(1); - ConstantSDNode *ConstantN1 = dyn_cast(N1); EVT VT = N->getValueType(0); const bool FullFP16 = DAG.getSubtarget().hasFullFP16(); @@ -16605,8 +16604,7 @@ performExtractVectorEltCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, // (extract_vector_elt (vXf32 Other) 1)) // For strict_fadd we need to make sure the old strict_fadd can be deleted, so // we can only do this when it's used only by the extract_vector_elt. - if (ConstantN1 && ConstantN1->getZExtValue() == 0 && - hasPairwiseAdd(N0->getOpcode(), VT, FullFP16) && + if (isNullConstant(N1) && hasPairwiseAdd(N0->getOpcode(), VT, FullFP16) && (!IsStrict || N0.hasOneUse())) { SDLoc DL(N0); SDValue N00 = N0->getOperand(IsStrict ? 1 : 0); diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index d71ea74..e3f581e 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -7246,10 +7246,8 @@ SDValue SITargetLowering::lowerRawBufferAtomicIntrin(SDValue Op, // Return a value to use for the idxen operand by examining the vindex operand. static unsigned getIdxEn(SDValue VIndex) { - if (auto VIndexC = dyn_cast(VIndex)) - // No need to set idxen if vindex is known to be zero. - return VIndexC->getZExtValue() != 0; - return 1; + // No need to set idxen if vindex is known to be zero. + return isNullConstant(VIndex) ? 0 : 1; } SDValue @@ -11287,8 +11285,8 @@ SDValue SITargetLowering::performAddCombine(SDNode *N, } case ISD::ADDCARRY: { // add x, (addcarry y, 0, cc) => addcarry x, y, cc - auto C = dyn_cast(RHS.getOperand(1)); - if (!C || C->getZExtValue() != 0) break; + if (!isNullConstant(RHS.getOperand(1))) + break; SDValue Args[] = { LHS, RHS.getOperand(0), RHS.getOperand(2) }; return DAG.getNode(ISD::ADDCARRY, SDLoc(N), RHS->getVTList(), Args); }