From: Simon Pilgrim Date: Fri, 21 Jun 2019 10:54:30 +0000 (+0000) Subject: [X86] foldVectorXorShiftIntoCmp - use isConstOrConstSplat. NFCI. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=92b56282bb1c803bc84871f6d885f8182d351515;p=llvm [X86] foldVectorXorShiftIntoCmp - use isConstOrConstSplat. NFCI. Use the isConstOrConstSplat helper instead of inspecting the build vector manually. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364024 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 4e93ca60be4..e15acc7d993 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -38842,13 +38842,10 @@ static SDValue foldVectorXorShiftIntoCmp(SDNode *N, SelectionDAG &DAG, return SDValue(); // The shift should be smearing the sign bit across each vector element. - auto *ShiftBV = dyn_cast(Shift.getOperand(1)); - if (!ShiftBV) - return SDValue(); - - EVT ShiftEltTy = Shift.getValueType().getVectorElementType(); - auto *ShiftAmt = ShiftBV->getConstantSplatNode(); - if (!ShiftAmt || ShiftAmt->getZExtValue() != ShiftEltTy.getSizeInBits() - 1) + auto *ShiftAmt = + isConstOrConstSplat(Shift.getOperand(1), /*AllowUndefs*/ true); + if (!ShiftAmt || + ShiftAmt->getAPIntValue() != (Shift.getScalarValueSizeInBits() - 1)) return SDValue(); // Create a greater-than comparison against -1. We don't use the more obvious