Lines Matching refs:Pred
123 static bool isSameCompare(Value *V, CmpInst::Predicate Pred, Value *LHS, in isSameCompare() argument
130 if (CPred == Pred && CLHS == LHS && CRHS == RHS) in isSameCompare()
132 return CPred == CmpInst::getSwappedPredicate(Pred) && CLHS == RHS && in isSameCompare()
397 static Value *ThreadCmpOverSelect(CmpInst::Predicate Pred, Value *LHS, in ThreadCmpOverSelect() argument
407 Pred = CmpInst::getSwappedPredicate(Pred); in ThreadCmpOverSelect()
417 Value *TCmp = SimplifyCmpInst(Pred, TV, RHS, Q, MaxRecurse); in ThreadCmpOverSelect()
425 if (!isSameCompare(Cond, Pred, TV, RHS)) in ThreadCmpOverSelect()
431 Value *FCmp = SimplifyCmpInst(Pred, FV, RHS, Q, MaxRecurse); in ThreadCmpOverSelect()
439 if (!isSameCompare(Cond, Pred, FV, RHS)) in ThreadCmpOverSelect()
522 static Value *ThreadCmpOverPHI(CmpInst::Predicate Pred, Value *LHS, Value *RHS, in ThreadCmpOverPHI() argument
531 Pred = CmpInst::getSwappedPredicate(Pred); in ThreadCmpOverPHI()
545 Value *V = SimplifyCmpInst(Pred, Incoming, RHS, Q, MaxRecurse); in ThreadCmpOverPHI()
965 static bool isICmpTrue(ICmpInst::Predicate Pred, Value *LHS, Value *RHS, in isICmpTrue() argument
967 Value *V = SimplifyICmpInst(Pred, LHS, RHS, Q, MaxRecurse); in isICmpTrue()
2106 static Value *ExtractEquivalentCondition(Value *V, CmpInst::Predicate Pred, in ExtractEquivalentCondition() argument
2115 if (Pred == Cmp->getPredicate() && LHS == CmpLHS && RHS == CmpRHS) in ExtractEquivalentCondition()
2117 if (Pred == CmpInst::getSwappedPredicate(Cmp->getPredicate()) && in ExtractEquivalentCondition()
2153 const DominatorTree *DT, CmpInst::Predicate Pred, in computePointerICmp() argument
2164 (Pred == CmpInst::ICMP_EQ || Pred == CmpInst::ICMP_NE)) in computePointerICmp()
2166 !CmpInst::isTrueWhenEqual(Pred)); in computePointerICmp()
2169 switch (Pred) { in computePointerICmp()
2186 Pred = ICmpInst::getSignedPredicate(Pred); in computePointerICmp()
2202 return ConstantExpr::getICmp(Pred, LHSOffset, RHSOffset); in computePointerICmp()
2205 if (Pred == CmpInst::ICMP_EQ || Pred == CmpInst::ICMP_NE) { in computePointerICmp()
2253 !CmpInst::isTrueWhenEqual(Pred)); in computePointerICmp()
2264 !CmpInst::isTrueWhenEqual(Pred)); in computePointerICmp()
2274 return ConstantExpr::getICmp(Pred, in computePointerICmp()
2315 !CmpInst::isTrueWhenEqual(Pred)); in computePointerICmp()
2331 CmpInst::isFalseWhenEqual(Pred)); in computePointerICmp()
2339 static Value *simplifyICmpOfBools(CmpInst::Predicate Pred, Value *LHS, in simplifyICmpOfBools() argument
2350 switch (Pred) { in simplifyICmpOfBools()
2367 switch (Pred) { in simplifyICmpOfBools()
2385 switch (Pred) { in simplifyICmpOfBools()
2413 static Value *simplifyICmpWithZero(CmpInst::Predicate Pred, Value *LHS, in simplifyICmpWithZero() argument
2419 switch (Pred) { in simplifyICmpWithZero()
2697 static Value *simplifyICmpWithConstant(CmpInst::Predicate Pred, Value *LHS, in simplifyICmpWithConstant() argument
2707 if (Pred == ICmpInst::ICMP_SLT && match(RHS, m_Zero())) in simplifyICmpWithConstant()
2709 if (Pred == ICmpInst::ICMP_SGT && match(RHS, m_AllOnes())) in simplifyICmpWithConstant()
2718 ConstantRange RHS_CR = ConstantRange::makeExactICmpRegion(Pred, *C); in simplifyICmpWithConstant()
2753 static Value *simplifyICmpWithBinOp(CmpInst::Predicate Pred, Value *LHS, in simplifyICmpWithBinOp() argument
2769 ICmpInst::isEquality(Pred) || in simplifyICmpWithBinOp()
2770 (CmpInst::isUnsigned(Pred) && in simplifyICmpWithBinOp()
2772 (CmpInst::isSigned(Pred) && in simplifyICmpWithBinOp()
2779 ICmpInst::isEquality(Pred) || in simplifyICmpWithBinOp()
2780 (CmpInst::isUnsigned(Pred) && in simplifyICmpWithBinOp()
2782 (CmpInst::isSigned(Pred) && in simplifyICmpWithBinOp()
2788 if (Value *V = SimplifyICmpInst(Pred, A == RHS ? B : A, in simplifyICmpWithBinOp()
2796 SimplifyICmpInst(Pred, Constant::getNullValue(LHS->getType()), in simplifyICmpWithBinOp()
2823 if (Value *V = SimplifyICmpInst(Pred, Y, Z, Q, MaxRecurse - 1)) in simplifyICmpWithBinOp()
2832 if (Pred == ICmpInst::ICMP_ULT) in simplifyICmpWithBinOp()
2834 if (Pred == ICmpInst::ICMP_UGE) in simplifyICmpWithBinOp()
2837 if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SGE) { in simplifyICmpWithBinOp()
2841 return Pred == ICmpInst::ICMP_SLT ? getTrue(ITy) : getFalse(ITy); in simplifyICmpWithBinOp()
2843 return Pred == ICmpInst::ICMP_SLT ? getFalse(ITy) : getTrue(ITy); in simplifyICmpWithBinOp()
2848 if (Pred == ICmpInst::ICMP_ULE) in simplifyICmpWithBinOp()
2850 if (Pred == ICmpInst::ICMP_UGT) in simplifyICmpWithBinOp()
2853 if (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SLE) { in simplifyICmpWithBinOp()
2857 return Pred == ICmpInst::ICMP_SGT ? getTrue(ITy) : getFalse(ITy); in simplifyICmpWithBinOp()
2859 return Pred == ICmpInst::ICMP_SGT ? getFalse(ITy) : getTrue(ITy); in simplifyICmpWithBinOp()
2866 if (Pred == ICmpInst::ICMP_UGT) in simplifyICmpWithBinOp()
2868 if (Pred == ICmpInst::ICMP_ULE) in simplifyICmpWithBinOp()
2873 if (Pred == ICmpInst::ICMP_UGE) in simplifyICmpWithBinOp()
2875 if (Pred == ICmpInst::ICMP_ULT) in simplifyICmpWithBinOp()
2880 if (!CmpInst::isUnsigned(Pred) && match(LHS, m_Neg(m_ZExt(m_Value())))) { in simplifyICmpWithBinOp()
2883 if (Pred == ICmpInst::ICMP_SLT) in simplifyICmpWithBinOp()
2885 if (Pred == ICmpInst::ICMP_SGE) in simplifyICmpWithBinOp()
2887 if (Pred == ICmpInst::ICMP_EQ) in simplifyICmpWithBinOp()
2889 if (Pred == ICmpInst::ICMP_NE) in simplifyICmpWithBinOp()
2893 if (Pred == ICmpInst::ICMP_SLE) in simplifyICmpWithBinOp()
2895 if (Pred == ICmpInst::ICMP_SGT) in simplifyICmpWithBinOp()
2903 switch (Pred) { in simplifyICmpWithBinOp()
2933 switch (Pred) { in simplifyICmpWithBinOp()
2966 if (Pred == ICmpInst::ICMP_UGT) in simplifyICmpWithBinOp()
2968 if (Pred == ICmpInst::ICMP_ULE) in simplifyICmpWithBinOp()
2977 if (Pred == ICmpInst::ICMP_ULT) in simplifyICmpWithBinOp()
2979 if (Pred == ICmpInst::ICMP_UGE) in simplifyICmpWithBinOp()
3004 if (Pred == ICmpInst::ICMP_EQ) in simplifyICmpWithBinOp()
3006 if (Pred == ICmpInst::ICMP_NE) in simplifyICmpWithBinOp()
3011 if (Pred == ICmpInst::ICMP_UGT) in simplifyICmpWithBinOp()
3013 if (Pred == ICmpInst::ICMP_ULE) in simplifyICmpWithBinOp()
3026 if (ICmpInst::isSigned(Pred) || !Q.IIQ.isExact(LBO) || in simplifyICmpWithBinOp()
3029 if (Value *V = SimplifyICmpInst(Pred, LBO->getOperand(0), in simplifyICmpWithBinOp()
3034 if (!ICmpInst::isEquality(Pred) || !Q.IIQ.isExact(LBO) || in simplifyICmpWithBinOp()
3037 if (Value *V = SimplifyICmpInst(Pred, LBO->getOperand(0), in simplifyICmpWithBinOp()
3044 if (Value *V = SimplifyICmpInst(Pred, LBO->getOperand(0), in simplifyICmpWithBinOp()
3053 if (!NSW && ICmpInst::isSigned(Pred)) in simplifyICmpWithBinOp()
3055 if (Value *V = SimplifyICmpInst(Pred, LBO->getOperand(0), in simplifyICmpWithBinOp()
3065 static Value *simplifyICmpWithAbsNabs(CmpInst::Predicate Pred, Value *Op0, in simplifyICmpWithAbsNabs() argument
3094 ConstantRange CmpRange = ConstantRange::makeExactICmpRegion(Pred, *C); in simplifyICmpWithAbsNabs()
3105 static Value *simplifyICmpWithMinMax(CmpInst::Predicate Pred, Value *LHS, in simplifyICmpWithMinMax() argument
3119 P = Pred; in simplifyICmpWithMinMax()
3126 P = CmpInst::getSwappedPredicate(Pred); in simplifyICmpWithMinMax()
3134 P = CmpInst::getSwappedPredicate(Pred); in simplifyICmpWithMinMax()
3142 P = Pred; in simplifyICmpWithMinMax()
3193 P = Pred; in simplifyICmpWithMinMax()
3200 P = CmpInst::getSwappedPredicate(Pred); in simplifyICmpWithMinMax()
3208 P = CmpInst::getSwappedPredicate(Pred); in simplifyICmpWithMinMax()
3216 P = Pred; in simplifyICmpWithMinMax()
3266 if (Pred == CmpInst::ICMP_SGE) in simplifyICmpWithMinMax()
3269 if (Pred == CmpInst::ICMP_SLT) in simplifyICmpWithMinMax()
3276 if (Pred == CmpInst::ICMP_SLE) in simplifyICmpWithMinMax()
3279 if (Pred == CmpInst::ICMP_SGT) in simplifyICmpWithMinMax()
3286 if (Pred == CmpInst::ICMP_UGE) in simplifyICmpWithMinMax()
3289 if (Pred == CmpInst::ICMP_ULT) in simplifyICmpWithMinMax()
3296 if (Pred == CmpInst::ICMP_ULE) in simplifyICmpWithMinMax()
3299 if (Pred == CmpInst::ICMP_UGT) in simplifyICmpWithMinMax()
3311 CmpInst::Predicate Pred = (CmpInst::Predicate)Predicate; in SimplifyICmpInst() local
3312 assert(CmpInst::isIntPredicate(Pred) && "Not an integer compare!"); in SimplifyICmpInst()
3316 return ConstantFoldCompareInstOperands(Pred, CLHS, CRHS, Q.DL, Q.TLI); in SimplifyICmpInst()
3320 Pred = CmpInst::getSwappedPredicate(Pred); in SimplifyICmpInst()
3328 return ConstantInt::get(ITy, CmpInst::isTrueWhenEqual(Pred)); in SimplifyICmpInst()
3330 if (Value *V = simplifyICmpOfBools(Pred, LHS, RHS, Q)) in SimplifyICmpInst()
3333 if (Value *V = simplifyICmpWithZero(Pred, LHS, RHS, Q)) in SimplifyICmpInst()
3336 if (Value *V = simplifyICmpWithConstant(Pred, LHS, RHS, Q.IIQ)) in SimplifyICmpInst()
3352 auto Satisfied_CR = ConstantRange::makeSatisfyingICmpRegion(Pred, RHS_CR); in SimplifyICmpInst()
3357 CmpInst::getInversePredicate(Pred), RHS_CR); in SimplifyICmpInst()
3376 if (Value *V = SimplifyICmpInst(Pred, SrcOp, in SimplifyICmpInst()
3383 if (Value *V = SimplifyICmpInst(Pred, SrcOp, RI->getOperand(0), in SimplifyICmpInst()
3395 if (Value *V = SimplifyICmpInst(ICmpInst::getUnsignedPredicate(Pred), in SimplifyICmpInst()
3411 if (Value *V = SimplifyICmpInst(ICmpInst::getUnsignedPredicate(Pred), in SimplifyICmpInst()
3418 switch (Pred) { in SimplifyICmpInst()
3455 if (Value *V = SimplifyICmpInst(Pred, SrcOp, RI->getOperand(0), in SimplifyICmpInst()
3470 if (Value *V = SimplifyICmpInst(Pred, SrcOp, Trunc, Q, MaxRecurse-1)) in SimplifyICmpInst()
3476 switch (Pred) { in SimplifyICmpInst()
3523 if (ICmpInst::isEquality(Pred) && in SimplifyICmpInst()
3525 return Pred == ICmpInst::ICMP_NE ? getTrue(ITy) : getFalse(ITy); in SimplifyICmpInst()
3528 if (Value *V = simplifyICmpWithBinOp(Pred, LHS, RHS, Q, MaxRecurse)) in SimplifyICmpInst()
3531 if (Value *V = simplifyICmpWithMinMax(Pred, LHS, RHS, Q, MaxRecurse)) in SimplifyICmpInst()
3534 if (Value *V = simplifyICmpWithAbsNabs(Pred, LHS, RHS)) in SimplifyICmpInst()
3540 if (auto *C = computePointerICmp(Q.DL, Q.TLI, Q.DT, Pred, Q.AC, Q.CxtI, in SimplifyICmpInst()
3549 if (auto *C = computePointerICmp(Q.DL, Q.TLI, Q.DT, Pred, Q.AC, Q.CxtI, in SimplifyICmpInst()
3558 (ICmpInst::isEquality(Pred) || in SimplifyICmpInst()
3560 Pred == ICmpInst::getSignedPredicate(Pred)))) { in SimplifyICmpInst()
3572 return ConstantExpr::getICmp(Pred, NewLHS, NewRHS); in SimplifyICmpInst()
3580 if (Value *V = ThreadCmpOverSelect(Pred, LHS, RHS, Q, MaxRecurse)) in SimplifyICmpInst()
3586 if (Value *V = ThreadCmpOverPHI(Pred, LHS, RHS, Q, MaxRecurse)) in SimplifyICmpInst()
3602 CmpInst::Predicate Pred = (CmpInst::Predicate)Predicate; in SimplifyFCmpInst() local
3603 assert(CmpInst::isFPPredicate(Pred) && "Not an FP compare!"); in SimplifyFCmpInst()
3607 return ConstantFoldCompareInstOperands(Pred, CLHS, CRHS, Q.DL, Q.TLI); in SimplifyFCmpInst()
3611 Pred = CmpInst::getSwappedPredicate(Pred); in SimplifyFCmpInst()
3616 if (Pred == FCmpInst::FCMP_FALSE) in SimplifyFCmpInst()
3618 if (Pred == FCmpInst::FCMP_TRUE) in SimplifyFCmpInst()
3622 if (Pred == FCmpInst::FCMP_UNO || Pred == FCmpInst::FCMP_ORD) in SimplifyFCmpInst()
3625 return ConstantInt::get(RetTy, Pred == FCmpInst::FCMP_ORD); in SimplifyFCmpInst()
3628 assert((FCmpInst::isOrdered(Pred) || FCmpInst::isUnordered(Pred)) && in SimplifyFCmpInst()
3631 return ConstantInt::get(RetTy, CmpInst::isUnordered(Pred)); in SimplifyFCmpInst()
3638 return ConstantInt::get(RetTy, CmpInst::isUnordered(Pred)); in SimplifyFCmpInst()
3643 if (CmpInst::isTrueWhenEqual(Pred)) in SimplifyFCmpInst()
3645 if (CmpInst::isFalseWhenEqual(Pred)) in SimplifyFCmpInst()
3655 switch (Pred) { in SimplifyFCmpInst()
3666 switch (Pred) { in SimplifyFCmpInst()
3679 switch (Pred) { in SimplifyFCmpInst()
3703 switch (Pred) { in SimplifyFCmpInst()
3727 if (Value *V = ThreadCmpOverSelect(Pred, LHS, RHS, Q, MaxRecurse)) in SimplifyFCmpInst()
3733 if (Value *V = ThreadCmpOverPHI(Pred, LHS, RHS, Q, MaxRecurse)) in SimplifyFCmpInst()
3878 ICmpInst::Predicate Pred, in simplifySelectWithFakeICmpEq() argument
3882 if (!decomposeBitTestICmp(CmpLHS, CmpRHS, Pred, X, Mask)) in simplifySelectWithFakeICmpEq()
3886 Pred == ICmpInst::ICMP_EQ); in simplifySelectWithFakeICmpEq()
3894 ICmpInst::Predicate Pred; in simplifySelectWithICmpCond() local
3896 if (!match(CondVal, m_ICmp(Pred, m_Value(CmpLHS), m_Value(CmpRHS)))) in simplifySelectWithICmpCond()
3899 if (ICmpInst::isEquality(Pred) && match(CmpRHS, m_Zero())) { in simplifySelectWithICmpCond()
3904 Pred == ICmpInst::ICMP_EQ)) in simplifySelectWithICmpCond()
3920 return Pred == ICmpInst::ICMP_NE ? TrueVal : X; in simplifySelectWithICmpCond()
3927 return Pred == ICmpInst::ICMP_EQ ? FalseVal : X; in simplifySelectWithICmpCond()
3931 if (Value *V = simplifySelectWithFakeICmpEq(CmpLHS, CmpRHS, Pred, in simplifySelectWithICmpCond()
3938 if (Pred == ICmpInst::ICMP_EQ) { in simplifySelectWithICmpCond()
3949 } else if (Pred == ICmpInst::ICMP_NE) { in simplifySelectWithICmpCond()
3968 FCmpInst::Predicate Pred; in simplifySelectWithFCmp() local
3969 if (!match(Cond, m_FCmp(Pred, m_Specific(T), m_Specific(F))) && in simplifySelectWithFCmp()
3970 !match(Cond, m_FCmp(Pred, m_Specific(F), m_Specific(T)))) in simplifySelectWithFCmp()
3981 if (Pred == FCmpInst::FCMP_OEQ) in simplifySelectWithFCmp()
3986 if (Pred == FCmpInst::FCMP_UNE) in simplifySelectWithFCmp()