Index: llvm/include/llvm/CodeGen/TargetLowering.h =================================================================== --- llvm/include/llvm/CodeGen/TargetLowering.h +++ llvm/include/llvm/CodeGen/TargetLowering.h @@ -3678,10 +3678,6 @@ /// from getBooleanContents(). bool isConstTrueVal(const SDNode *N) const; - /// Return if the N is a constant or constant vector equal to the false value - /// from getBooleanContents(). - bool isConstFalseVal(const SDNode *N) const; - /// Return if \p N is a True value when extended to \p VT. bool isExtendedTrueVal(const ConstantSDNode *N, EVT VT, bool SExt) const; Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp =================================================================== --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -909,7 +909,7 @@ if (N.getOpcode() != ISD::SELECT_CC || !TLI.isConstTrueVal(N.getOperand(2).getNode()) || - !TLI.isConstFalseVal(N.getOperand(3).getNode())) + !isNullOrNullSplat(N.getOperand(3))) return false; if (TLI.getBooleanContents(N.getValueType()) == Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp =================================================================== --- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -3207,30 +3207,6 @@ llvm_unreachable("Invalid boolean contents"); } -bool TargetLowering::isConstFalseVal(const SDNode *N) const { - if (!N) - return false; - - const ConstantSDNode *CN = dyn_cast(N); - if (!CN) { - const BuildVectorSDNode *BV = dyn_cast(N); - if (!BV) - return false; - - // Only interested in constant splats, we don't care about undef - // elements in identifying boolean constants and getConstantSplatNode - // returns NULL if all ops are undef; - CN = BV->getConstantSplatNode(); - if (!CN) - return false; - } - - if (getBooleanContents(N->getValueType(0)) == UndefinedBooleanContent) - return !CN->getAPIntValue()[0]; - - return CN->isZero(); -} - bool TargetLowering::isExtendedTrueVal(const ConstantSDNode *N, EVT VT, bool SExt) const { if (VT == MVT::i1) @@ -3742,7 +3718,7 @@ if (TopSetCC.getValueType() == MVT::i1 && VT == MVT::i1 && TopSetCC.getOpcode() == ISD::SETCC && (N0Opc == ISD::ZERO_EXTEND || N0Opc == ISD::SIGN_EXTEND) && - (isConstFalseVal(N1C) || + (isNullOrNullSplat(N1) || isExtendedTrueVal(N1C, N0->getValueType(0), SExt))) { bool Inverse = (N1C->isZero() && Cond == ISD::SETEQ) ||