summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2019-06-21 10:54:30 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2019-06-21 10:54:30 +0000
commitb5733581c463626658b1336840f82d7576f78fce (patch)
tree2dffe51495007c845b506bfca364320dba3c636b
parent1da9e4c910d1cf1048910aca82d900fa78682a60 (diff)
downloadbcm5719-llvm-b5733581c463626658b1336840f82d7576f78fce.tar.gz
bcm5719-llvm-b5733581c463626658b1336840f82d7576f78fce.zip
[X86] foldVectorXorShiftIntoCmp - use isConstOrConstSplat. NFCI.
Use the isConstOrConstSplat helper instead of inspecting the build vector manually. llvm-svn: 364024
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 4e93ca60be4..e15acc7d993 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/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<BuildVectorSDNode>(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
OpenPOWER on IntegriCloud