OSDN Git Service

[X86] Simplify some code in combineSetCC. NFCI
authorCraig Topper <craig.topper@intel.com>
Sat, 25 Nov 2017 07:20:24 +0000 (07:20 +0000)
committerCraig Topper <craig.topper@intel.com>
Sat, 25 Nov 2017 07:20:24 +0000 (07:20 +0000)
Make the condition for doing a std::swap simpler so we don't have to repeat the full checks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318970 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp

index 1673ce5..9985b72 100644 (file)
@@ -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");