diff options
| author | Craig Topper <craig.topper@intel.com> | 2017-11-25 07:20:24 +0000 | 
|---|---|---|
| committer | Craig Topper <craig.topper@intel.com> | 2017-11-25 07:20:24 +0000 | 
| commit | a456f13af2fcfce825f12f47a6af61d2624f9572 (patch) | |
| tree | ef12017885318dc49e03e2f37bb07dadfe58e15b | |
| parent | 696bfc08d8b10e7cf288b28069214956b18c151f (diff) | |
| download | bcm5719-llvm-a456f13af2fcfce825f12f47a6af61d2624f9572.tar.gz bcm5719-llvm-a456f13af2fcfce825f12f47a6af61d2624f9572.zip | |
[X86] Simplify some code in combineSetCC. NFCI
Make the condition for doing a std::swap simpler so we don't have to repeat the full checks.
llvm-svn: 318970
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 16 | 
1 files changed, 6 insertions, 10 deletions
| diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 1673ce55fa0..9985b727c0e 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -35904,21 +35904,17 @@ static SDValue combineSetCC(SDNode *N, SelectionDAG &DAG,    if (VT.isVector() && VT.getVectorElementType() == MVT::i1 &&        (CC == ISD::SETNE || CC == ISD::SETEQ || ISD::isSignedIntSetCC(CC))) { +    // Put build_vectors on the right. +    if (LHS.getOpcode() == ISD::BUILD_VECTOR) { +      std::swap(LHS, RHS); +      CC = ISD::getSetCCSwappedOperands(CC); +    } +      bool IsSEXT0 =          (LHS.getOpcode() == ISD::SIGN_EXTEND) &&          (LHS.getOperand(0).getValueType().getVectorElementType() == MVT::i1);      bool IsVZero1 = ISD::isBuildVectorAllZeros(RHS.getNode()); -    if (!IsSEXT0 || !IsVZero1) { -      // Swap the operands and update the condition code. -      std::swap(LHS, RHS); -      CC = ISD::getSetCCSwappedOperands(CC); - -      IsSEXT0 = (LHS.getOpcode() == ISD::SIGN_EXTEND) && -                (LHS.getOperand(0).getValueType().getScalarType() == MVT::i1); -      IsVZero1 = ISD::isBuildVectorAllZeros(RHS.getNode()); -    } -      if (IsSEXT0 && IsVZero1) {        assert(VT == LHS.getOperand(0).getValueType() &&               "Uexpected operand type"); | 

