From 75650b93d4d93ffceaa674752401c3a7bcc7b853 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Fri, 5 May 2017 20:53:52 +0000 Subject: [PATCH] [X86] Use SDValue::getConstantOperandVal helper. NFCI. llvm-svn: 302286 --- lib/Target/X86/X86ISelLowering.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index a1ade437297..bc670f452e6 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -6228,7 +6228,7 @@ static SDValue LowerBuildVectorv4x32(SDValue Op, SelectionDAG &DAG, Elt = Op->getOperand(EltIdx); // By construction, Elt is a EXTRACT_VECTOR_ELT with constant index. - EltMaskIdx = cast(Elt.getOperand(1))->getZExtValue(); + EltMaskIdx = Elt.getConstantOperandVal(1); if (Elt.getOperand(0) != V1 || EltMaskIdx != EltIdx) break; Mask[EltIdx] = EltIdx; @@ -6259,8 +6259,7 @@ static SDValue LowerBuildVectorv4x32(SDValue Op, SelectionDAG &DAG, SDValue SrcVector = Current->getOperand(0); if (!V1.getNode()) V1 = SrcVector; - CanFold = SrcVector == V1 && - cast(Current.getOperand(1))->getZExtValue() == i; + CanFold = (SrcVector == V1) && (Current.getConstantOperandVal(1) == i); } if (!CanFold) @@ -31617,10 +31616,9 @@ static SDValue combineLogicBlendIntoPBLENDV(SDNode *N, SelectionDAG &DAG, if (auto *AmtBV = dyn_cast(Mask.getOperand(1))) if (auto *AmtConst = AmtBV->getConstantSplatNode()) SraAmt = AmtConst->getZExtValue(); - } else if (Mask.getOpcode() == X86ISD::VSRAI) { - SDValue SraC = Mask.getOperand(1); - SraAmt = cast(SraC)->getZExtValue(); - } + } else if (Mask.getOpcode() == X86ISD::VSRAI) + SraAmt = Mask.getConstantOperandVal(1); + if ((SraAmt + 1) != EltBits) return SDValue(); @@ -34434,8 +34432,7 @@ static SDValue combineX86ADD(SDNode *N, SelectionDAG &DAG, if (Carry.getOpcode() == ISD::SETCC || Carry.getOpcode() == X86ISD::SETCC || Carry.getOpcode() == X86ISD::SETCC_CARRY) { - auto *Cond = cast(Carry.getOperand(0)); - if (Cond->getZExtValue() == X86::COND_B) + if (Carry.getConstantOperandVal(0) == X86::COND_B) return DCI.CombineTo(N, SDValue(N, 0), Carry.getOperand(1)); } }