Lines Matching refs:Pred
80 static bool isSignTest(ICmpInst::Predicate &Pred, const APInt &C) { in isSignTest() argument
81 if (!ICmpInst::isSigned(Pred)) in isSignTest()
85 return ICmpInst::isRelational(Pred); in isSignTest()
88 if (Pred == ICmpInst::ICMP_SLT) { in isSignTest()
89 Pred = ICmpInst::ICMP_SLE; in isSignTest()
93 if (Pred == ICmpInst::ICMP_SGT) { in isSignTest()
94 Pred = ICmpInst::ICMP_SGE; in isSignTest()
912 ICmpInst::Predicate Pred) { in foldICmpAddOpConst() argument
921 if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_ULE) { in foldICmpAddOpConst()
930 if (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_UGE) in foldICmpAddOpConst()
942 if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SLE) in foldICmpAddOpConst()
953 assert(Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SGE); in foldICmpAddOpConst()
966 auto getICmp = [&I](CmpInst::Predicate Pred, Value *LHS, Value *RHS) { in foldICmpShrConstConst() argument
968 Pred = CmpInst::getInversePredicate(Pred); in foldICmpShrConstConst()
969 return new ICmpInst(Pred, LHS, RHS); in foldICmpShrConstConst()
1025 auto getICmp = [&I](CmpInst::Predicate Pred, Value *LHS, Value *RHS) { in foldICmpShlConstConst() argument
1027 Pred = CmpInst::getInversePredicate(Pred); in foldICmpShlConstConst()
1028 return new ICmpInst(Pred, LHS, RHS); in foldICmpShlConstConst()
1155 ICmpInst::Predicate Pred; in foldIRemByPowerOfTwoToBitTest() local
1157 if (!match(&I, m_ICmp(Pred, m_OneUse(m_IRem(m_Value(X), m_Value(Y))), in foldIRemByPowerOfTwoToBitTest()
1165 return ICmpInst::Create(Instruction::ICmp, Pred, Masked, Zero); in foldIRemByPowerOfTwoToBitTest()
1172 ICmpInst::Predicate Pred; in foldSignBitTest() local
1173 if (!I.isEquality() || !match(&I, m_ICmp(Pred, m_Instruction(Val), m_Zero()))) in foldSignBitTest()
1195 Pred == ICmpInst::ICMP_EQ ? ICmpInst::ICMP_SGE in foldSignBitTest()
1202 CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpWithZero() local
1207 if (Pred == ICmpInst::ICMP_SGT) { in foldICmpWithZero()
1211 return new ICmpInst(Pred, B, Cmp.getOperand(1)); in foldICmpWithZero()
1213 return new ICmpInst(Pred, A, Cmp.getOperand(1)); in foldICmpWithZero()
1226 ICmpInst::isEquality(Pred)) { in foldICmpWithZero()
1230 return new ICmpInst(Pred, X, Cmp.getOperand(1)); in foldICmpWithZero()
1236 ICmpInst::isEquality(Pred)) { in foldICmpWithZero()
1242 return new ICmpInst(Pred, Y, Cmp.getOperand(1)); in foldICmpWithZero()
1248 return new ICmpInst(Pred, X, Cmp.getOperand(1)); in foldICmpWithZero()
1259 return new ICmpInst(Pred, Y, Cmp.getOperand(1)); in foldICmpWithZero()
1264 return new ICmpInst(Pred, X, Cmp.getOperand(1)); in foldICmpWithZero()
1295 CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpWithConstant() local
1299 if (Pred == ICmpInst::ICMP_UGT && match(Op1, m_ConstantInt(CI)) && in foldICmpWithConstant()
1314 ConstantFoldCompareInstOperands(Pred, cast<Constant>(V), C, DL); in foldICmpWithConstant()
1321 for (auto [V, Pred] : zip(Ops, Phi->blocks())) in foldICmpWithConstant()
1322 NewPhi->addIncoming(V, Pred); in foldICmpWithConstant()
1342 CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpWithDominatingICmp() local
1343 ConstantRange CR = ConstantRange::makeExactICmpRegion(Pred, *C); in foldICmpWithDominatingICmp()
1373 bool IsSignBit = isSignBitCheck(Pred, *C, UnusedBit); in foldICmpWithDominatingICmp()
1411 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpTruncConstant() local
1416 if (Pred == ICmpInst::ICMP_SLT && match(X, m_Signum(m_Value(V)))) in foldICmpTruncConstant()
1432 auto NewPred = (Pred == Cmp.ICMP_EQ) ? Cmp.ICMP_UGE : Cmp.ICMP_ULT; in foldICmpTruncConstant()
1438 return new ICmpInst(Pred, Y, ConstantInt::get(SrcTy, C.logBase2())); in foldICmpTruncConstant()
1449 return new ICmpInst(Pred, And, WideC); in foldICmpTruncConstant()
1461 return new ICmpInst(Pred, X, ConstantInt::get(SrcTy, NewRHS)); in foldICmpTruncConstant()
1471 if (isSignBitCheck(Pred, C, TrueIfSigned) && in foldICmpTruncConstant()
1492 ICmpInst::Predicate Pred; in foldICmpTruncWithTruncOrExt() local
1495 if (match(&Cmp, m_ICmp(Pred, m_Trunc(m_Value(X)), m_Trunc(m_Value(Y))))) { in foldICmpTruncWithTruncOrExt()
1502 Pred = Cmp.getSwappedPredicate(Pred); in foldICmpTruncWithTruncOrExt()
1506 else if (match(&Cmp, m_c_ICmp(Pred, m_Trunc(m_Value(X)), in foldICmpTruncWithTruncOrExt()
1535 return new ICmpInst(Pred, X, NewY); in foldICmpTruncWithTruncOrExt()
1553 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpXorConstant() local
1574 Pred = Cmp.getFlippedSignednessPredicate(); in foldICmpXorConstant()
1575 return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), C ^ *XorC)); in foldICmpXorConstant()
1580 Pred = Cmp.getFlippedSignednessPredicate(); in foldICmpXorConstant()
1581 Pred = Cmp.getSwappedPredicate(Pred); in foldICmpXorConstant()
1582 return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), C ^ *XorC)); in foldICmpXorConstant()
1587 if (Pred == ICmpInst::ICMP_UGT) { in foldICmpXorConstant()
1595 if (Pred == ICmpInst::ICMP_ULT) { in foldICmpXorConstant()
1614 CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpXorShiftConst() local
1616 if (Pred == ICmpInst::ICMP_ULT) in foldICmpXorShiftConst()
1618 else if (Pred == ICmpInst::ICMP_UGT && !C.isMaxValue()) in foldICmpXorShiftConst()
1635 Pred == ICmpInst::ICMP_ULT ? PowerOf2 << 1 : ((PowerOf2 << 1) - 1); in foldICmpXorShiftConst()
1636 return new ICmpInst(Pred, Add, ConstantInt::get(XType, Bound)); in foldICmpXorShiftConst()
1840 const ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpAndConstant() local
1842 if (isSignBitCheck(Pred, C, TrueIfNeg)) { in foldICmpAndConstant()
1883 Pred == CmpInst::ICMP_EQ ? CmpInst::ICMP_UGT : CmpInst::ICMP_ULE; in foldICmpAndConstant()
1896 if (C.isZero() && (Pred == CmpInst::ICMP_EQ || And->hasOneUse())) { in foldICmpAndConstant()
1905 if (Pred == CmpInst::ICMP_NE) in foldICmpAndConstant()
1918 if (C.isZero() ^ (Pred == CmpInst::ICMP_NE)) { in foldICmpAndConstant()
1974 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpOrXorSubChain() local
1975 auto BOpc = Pred == CmpInst::ICMP_EQ ? Instruction::And : Instruction::Or; in foldICmpOrXorSubChain()
1976 Value *LhsCmp = Builder.CreateICmp(Pred, CmpValues.rbegin()->first, in foldICmpOrXorSubChain()
1980 Value *RhsCmp = Builder.CreateICmp(Pred, It->first, It->second); in foldICmpOrXorSubChain()
1991 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpOrConstant() local
1995 if (Pred == ICmpInst::ICMP_SLT && match(Or, m_Signum(m_Value(V)))) in foldICmpOrConstant()
2007 Pred = (Pred == CmpInst::ICMP_EQ) ? CmpInst::ICMP_ULE : CmpInst::ICMP_UGT; in foldICmpOrConstant()
2008 return new ICmpInst(Pred, OrOp0, OrOp1); in foldICmpOrConstant()
2018 return new ICmpInst(Pred, And, NewC); in foldICmpOrConstant()
2026 if (isSignBitCheck(Pred, C, TrueIfSigned) && in foldICmpOrConstant()
2036 switch (Pred) { in foldICmpOrConstant()
2042 return new ICmpInst(Pred, X, ConstantInt::getNullValue(X->getType())); in foldICmpOrConstant()
2049 return new ICmpInst(ICmpInst::getFlippedStrictnessPredicate(Pred), X, in foldICmpOrConstant()
2065 Builder.CreateICmp(Pred, P, ConstantInt::getNullValue(P->getType())); in foldICmpOrConstant()
2067 Builder.CreateICmp(Pred, Q, ConstantInt::getNullValue(Q->getType())); in foldICmpOrConstant()
2068 auto BOpc = Pred == CmpInst::ICMP_EQ ? Instruction::And : Instruction::Or; in foldICmpOrConstant()
2082 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpMulConstant() local
2091 return new ICmpInst(Pred, X, ConstantInt::getNullValue(MulTy)); in foldICmpMulConstant()
2101 if (isSignTest(Pred, C) && Mul->hasNoSignedWrap()) { in foldICmpMulConstant()
2103 Pred = ICmpInst::getSwappedPredicate(Pred); in foldICmpMulConstant()
2104 return new ICmpInst(Pred, X, ConstantInt::getNullValue(MulTy)); in foldICmpMulConstant()
2116 return new ICmpInst(Pred, X, NewC); in foldICmpMulConstant()
2128 return new ICmpInst(Pred, X, NewC); in foldICmpMulConstant()
2138 if (Mul->hasNoSignedWrap() && ICmpInst::isSigned(Pred)) { in foldICmpMulConstant()
2143 Pred = ICmpInst::getSwappedPredicate(Pred); in foldICmpMulConstant()
2145 if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SGE) { in foldICmpMulConstant()
2149 assert((Pred == ICmpInst::ICMP_SLE || Pred == ICmpInst::ICMP_SGT) && in foldICmpMulConstant()
2154 } else if (Mul->hasNoUnsignedWrap() && ICmpInst::isUnsigned(Pred)) { in foldICmpMulConstant()
2155 if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_UGE) { in foldICmpMulConstant()
2159 assert((Pred == ICmpInst::ICMP_ULE || Pred == ICmpInst::ICMP_UGT) && in foldICmpMulConstant()
2166 return NewC ? new ICmpInst(Pred, X, NewC) : nullptr; in foldICmpMulConstant()
2179 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpShlOne() local
2187 if (Pred == ICmpInst::ICMP_ULT) in foldICmpShlOne()
2188 Pred = ICmpInst::ICMP_ULE; in foldICmpShlOne()
2189 else if (Pred == ICmpInst::ICMP_UGE) in foldICmpShlOne()
2190 Pred = ICmpInst::ICMP_UGT; in foldICmpShlOne()
2194 return new ICmpInst(Pred, Y, ConstantInt::get(ShiftType, CLog2)); in foldICmpShlOne()
2199 if (Pred == ICmpInst::ICMP_SGT && C.sle(0)) in foldICmpShlOne()
2206 if (Pred == ICmpInst::ICMP_SLT && (C-1).sle(0)) in foldICmpShlOne()
2221 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpShlConstant() local
2228 return new ICmpInst(Pred, Shl->getOperand(0), Cmp.getOperand(1)); in foldICmpShlConstant()
2232 if (ICmpInst::isEquality(Pred) && C.isZero() && in foldICmpShlConstant()
2234 return new ICmpInst(Pred, Shl->getOperand(0), Cmp.getOperand(1)); in foldICmpShlConstant()
2243 (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SLT)) in foldICmpShlConstant()
2244 if (C.isZero() || (Pred == ICmpInst::ICMP_SGT ? C.isAllOnes() : C.isOne())) in foldICmpShlConstant()
2245 return new ICmpInst(Pred, Shl->getOperand(0), Cmp.getOperand(1)); in foldICmpShlConstant()
2264 if (Pred == ICmpInst::ICMP_SGT) { in foldICmpShlConstant()
2267 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC)); in foldICmpShlConstant()
2269 if ((Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_NE) && in foldICmpShlConstant()
2272 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC)); in foldICmpShlConstant()
2274 if (Pred == ICmpInst::ICMP_SLT) { in foldICmpShlConstant()
2281 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC)); in foldICmpShlConstant()
2289 if (Pred == ICmpInst::ICMP_UGT) { in foldICmpShlConstant()
2292 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC)); in foldICmpShlConstant()
2294 if ((Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_NE) && in foldICmpShlConstant()
2297 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC)); in foldICmpShlConstant()
2299 if (Pred == ICmpInst::ICMP_ULT) { in foldICmpShlConstant()
2306 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC)); in foldICmpShlConstant()
2317 return new ICmpInst(Pred, And, LShrC); in foldICmpShlConstant()
2322 if (Shl->hasOneUse() && isSignBitCheck(Pred, C, TrueIfSigned)) { in foldICmpShlConstant()
2336 (Pred == ICmpInst::ICMP_ULE || Pred == ICmpInst::ICMP_UGT)) { in foldICmpShlConstant()
2338 return new ICmpInst(Pred == ICmpInst::ICMP_ULE ? ICmpInst::ICMP_EQ in foldICmpShlConstant()
2344 (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_UGE)) { in foldICmpShlConstant()
2347 return new ICmpInst(Pred == ICmpInst::ICMP_ULT ? ICmpInst::ICMP_EQ in foldICmpShlConstant()
2367 return new ICmpInst(Pred, Builder.CreateTrunc(X, TruncTy), NewC); in foldICmpShlConstant()
2380 CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpShrConstant() local
2382 return new ICmpInst(Pred, X, Cmp.getOperand(1)); in foldICmpShrConstant()
2394 isSignBitCheck(Pred, C, TrueIfSigned)) in foldICmpShrConstant()
2403 (Pred == CmpInst::ICMP_UGT || Pred == CmpInst::ICMP_ULT)) { in foldICmpShrConstant()
2404 bool IsUGT = Pred == CmpInst::ICMP_UGT; in foldICmpShrConstant()
2434 if (IsExact || Pred == CmpInst::ICMP_SLT || Pred == CmpInst::ICMP_ULT) { in foldICmpShrConstant()
2440 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, ShiftedC)); in foldICmpShrConstant()
2442 if (Pred == CmpInst::ICMP_SGT) { in foldICmpShrConstant()
2447 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, ShiftedC)); in foldICmpShrConstant()
2449 if (Pred == CmpInst::ICMP_UGT) { in foldICmpShrConstant()
2456 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, ShiftedC)); in foldICmpShrConstant()
2464 if (Pred == CmpInst::ICMP_UGT) { in foldICmpShrConstant()
2468 if (Pred == CmpInst::ICMP_ULT) { in foldICmpShrConstant()
2474 if (Pred == CmpInst::ICMP_ULT || (Pred == CmpInst::ICMP_UGT && IsExact)) { in foldICmpShrConstant()
2479 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, ShiftedC)); in foldICmpShrConstant()
2481 if (Pred == CmpInst::ICMP_UGT) { in foldICmpShrConstant()
2485 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, ShiftedC)); in foldICmpShrConstant()
2504 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, C << ShAmtVal)); in foldICmpShrConstant()
2508 if (Pred == CmpInst::ICMP_EQ) in foldICmpShrConstant()
2522 return new ICmpInst(Pred, And, ConstantInt::get(ShrTy, C << ShAmtVal)); in foldICmpShrConstant()
2534 const ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpSRemConstant() local
2535 if (Pred != ICmpInst::ICMP_SGT && Pred != ICmpInst::ICMP_SLT && in foldICmpSRemConstant()
2536 Pred != ICmpInst::ICMP_EQ && Pred != ICmpInst::ICMP_NE) in foldICmpSRemConstant()
2551 if (((Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SLT) && in foldICmpSRemConstant()
2553 ((Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_NE) && in foldICmpSRemConstant()
2563 if (Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_NE) in foldICmpSRemConstant()
2564 return new ICmpInst(Pred, And, ConstantInt::get(Ty, C)); in foldICmpSRemConstant()
2569 if (Pred == ICmpInst::ICMP_SGT) in foldICmpSRemConstant()
2582 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpUDivConstant() local
2594 if (Pred == ICmpInst::ICMP_UGT) { in foldICmpUDivConstant()
2602 if (Pred == ICmpInst::ICMP_ULT) { in foldICmpUDivConstant()
2615 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpDivConstant() local
2631 Value *XBig = Builder.CreateICmp(Pred, X, ConstantInt::get(Ty, C)); in foldICmpDivConstant()
2632 Value *YOne = Builder.CreateICmp(Pred, Y, ConstantInt::get(Ty, 1)); in foldICmpDivConstant()
2633 auto Logic = Pred == ICmpInst::ICMP_EQ ? Instruction::And : Instruction::Or; in foldICmpDivConstant()
2744 Pred = ICmpInst::getSwappedPredicate(Pred); in foldICmpDivConstant()
2747 switch (Pred) { in foldICmpDivConstant()
2778 return new ICmpInst(Pred, X, ConstantInt::get(Ty, LoBound)); in foldICmpDivConstant()
2785 if (Pred == ICmpInst::ICMP_UGT) in foldICmpDivConstant()
2798 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpSubConstant() local
2805 return new ICmpInst(Pred, Y, in foldICmpSubConstant()
2828 return new ICmpInst(Pred, X, Y); in foldICmpSubConstant()
2840 if (Pred == ICmpInst::ICMP_SGT && C.isAllOnes()) in foldICmpSubConstant()
2844 if (Pred == ICmpInst::ICMP_SGT && C.isZero()) in foldICmpSubConstant()
2848 if (Pred == ICmpInst::ICMP_SLT && C.isZero()) in foldICmpSubConstant()
2852 if (Pred == ICmpInst::ICMP_SLT && C.isOne()) in foldICmpSubConstant()
2861 if (Pred == ICmpInst::ICMP_ULT && C.isPowerOf2() && in foldICmpSubConstant()
2867 if (Pred == ICmpInst::ICMP_UGT && (C + 1).isPowerOf2() && (*C2 & C) == C) in foldICmpSubConstant()
2937 const CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpAddConstant() local
2952 return ICmpInst::compare(APInt(BW, Res, true), C, Pred); in foldICmpAddConstant()
2974 (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SLT)) || in foldICmpAddConstant()
2976 (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_ULT))) { in foldICmpAddConstant()
2985 return new ICmpInst(Pred, X, ConstantInt::get(Ty, NewC)); in foldICmpAddConstant()
2988 auto CR = ConstantRange::makeExactICmpRegion(Pred, C).subtract(*C2); in foldICmpAddConstant()
3010 if (Pred == CmpInst::ICMP_UGT && C == *C2 + SMax) in foldICmpAddConstant()
3014 if (Pred == CmpInst::ICMP_ULT && C == *C2 + SMin) in foldICmpAddConstant()
3018 if (Pred == CmpInst::ICMP_SGT && C == *C2 - 1) in foldICmpAddConstant()
3022 if (Pred == CmpInst::ICMP_SLT && C == *C2) in foldICmpAddConstant()
3026 if (Pred == CmpInst::ICMP_ULT && C2->isAllOnes()) { in foldICmpAddConstant()
3038 if (Pred == ICmpInst::ICMP_ULT && C.isPowerOf2() && (*C2 & (C - 1)) == 0) in foldICmpAddConstant()
3045 if (Pred == ICmpInst::ICMP_UGT && (C + 1).isPowerOf2() && (*C2 & C) == 0) in foldICmpAddConstant()
3052 if (Pred == ICmpInst::ICMP_UGT) in foldICmpAddConstant()
3170 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpBitCast() local
3187 if ((Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_SLT || in foldICmpBitCast()
3188 Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SGT) && in foldICmpBitCast()
3190 return new ICmpInst(Pred, X, ConstantInt::getNullValue(X->getType())); in foldICmpBitCast()
3193 if (Pred == ICmpInst::ICMP_SLT && match(Op1, m_One())) in foldICmpBitCast()
3194 return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), 1)); in foldICmpBitCast()
3197 if (Pred == ICmpInst::ICMP_SGT && match(Op1, m_AllOnes())) in foldICmpBitCast()
3198 return new ICmpInst(Pred, X, in foldICmpBitCast()
3207 return new ICmpInst(Pred, X, ConstantInt::getNullValue(X->getType())); in foldICmpBitCast()
3216 isSignBitCheck(Pred, *C, TrueIfSigned)) { in foldICmpBitCast()
3256 return new ICmpInst(Pred, Cast, ConstantInt::getNullValue(DstType)); in foldICmpBitCast()
3269 return new ICmpInst(Pred, NewCast, ConstantInt::getNullValue(NewType)); in foldICmpBitCast()
3296 return new ICmpInst(Pred, Extract, NewC); in foldICmpBitCast()
3359 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpBinOpEqualityWithConstant() local
3360 bool isICMP_NE = Pred == ICmpInst::ICMP_NE; in foldICmpBinOpEqualityWithConstant()
3371 return new ICmpInst(Pred, NewRem, in foldICmpBinOpEqualityWithConstant()
3382 return new ICmpInst(Pred, BOp0, ConstantExpr::getSub(RHS, C2)); in foldICmpBinOpEqualityWithConstant()
3387 return new ICmpInst(Pred, BOp0, NegVal); in foldICmpBinOpEqualityWithConstant()
3389 return new ICmpInst(Pred, NegVal, BOp1); in foldICmpBinOpEqualityWithConstant()
3393 return new ICmpInst(Pred, BOp0, Neg); in foldICmpBinOpEqualityWithConstant()
3403 return new ICmpInst(Pred, BOp0, ConstantExpr::getXor(RHS, BOC)); in foldICmpBinOpEqualityWithConstant()
3406 return new ICmpInst(Pred, BOp0, BOp1); in foldICmpBinOpEqualityWithConstant()
3418 return new ICmpInst(Pred, And, NotBOC); in foldICmpBinOpEqualityWithConstant()
3431 return new ICmpInst(Pred, BOp0, Constant::getNullValue(BO->getType())); in foldICmpBinOpEqualityWithConstant()
3433 return new ICmpInst(Pred, BOp0, BOp1); in foldICmpBinOpEqualityWithConstant()
3441 return new ICmpInst(Pred, YC, BOp0); in foldICmpBinOpEqualityWithConstant()
3474 const ICmpInst::Predicate Pred = I.getPredicate(); in foldCtpopPow2Test() local
3475 if (((I.isEquality() || Pred == ICmpInst::ICMP_UGT) && CRhs == 1) || in foldCtpopPow2Test()
3476 (Pred == ICmpInst::ICMP_ULT && CRhs == 2)) { in foldCtpopPow2Test()
3485 (Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_ULT) in foldCtpopPow2Test()
3500 const ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpEqIntrinsicWithConstant() local
3507 return new ICmpInst(Pred, II->getArgOperand(0), ConstantInt::get(Ty, C)); in foldICmpEqIntrinsicWithConstant()
3512 return new ICmpInst(Pred, II->getArgOperand(0), in foldICmpEqIntrinsicWithConstant()
3517 return new ICmpInst(Pred, II->getArgOperand(0), in foldICmpEqIntrinsicWithConstant()
3524 return new ICmpInst(Pred, II->getArgOperand(0), in foldICmpEqIntrinsicWithConstant()
3538 return new ICmpInst(Pred, Builder.CreateAnd(II->getArgOperand(0), Mask1), in foldICmpEqIntrinsicWithConstant()
3549 return new ICmpInst(Pred, II->getArgOperand(0), in foldICmpEqIntrinsicWithConstant()
3563 return new ICmpInst(Pred, II->getArgOperand(0), in foldICmpEqIntrinsicWithConstant()
3576 return new ICmpInst(Pred, Or, Constant::getNullValue(Ty)); in foldICmpEqIntrinsicWithConstant()
3584 return new ICmpInst(Pred, II->getArgOperand(0), II->getArgOperand(1)); in foldICmpEqIntrinsicWithConstant()
3590 Pred == ICmpInst::ICMP_EQ ? ICmpInst::ICMP_ULE : ICmpInst::ICMP_UGT; in foldICmpEqIntrinsicWithConstant()
3608 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpIntrinsicWithIntrinsic() local
3621 return new ICmpInst(Pred, IIOp0->getOperand(0), IIOp1->getOperand(0)); in foldICmpIntrinsicWithIntrinsic()
3631 return new ICmpInst(Pred, IIOp0->getOperand(0), IIOp1->getOperand(0)); in foldICmpIntrinsicWithIntrinsic()
3646 return new ICmpInst(Pred, IIOp1->getOperand(0), CombinedRotate); in foldICmpIntrinsicWithIntrinsic()
3662 const ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpInstWithConstantAllowUndef() local
3672 return new ICmpInst(Pred, II->getArgOperand(0), Cmp.getOperand(1)); in foldICmpInstWithConstantAllowUndef()
3740 foldICmpUSubSatOrUAddSatWithConstant(ICmpInst::Predicate Pred, in foldICmpUSubSatOrUAddSatWithConstant() argument
3784 bool SatValCheck = ICmpInst::compare(SatVal, C, Pred); in foldICmpUSubSatOrUAddSatWithConstant()
3794 ConstantRange C2 = ConstantRange::makeExactICmpRegion(Pred, C); in foldICmpUSubSatOrUAddSatWithConstant()
3828 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpIntrinsicWithConstant() local
3837 Pred, cast<SaturatingInst>(II), C, Builder)) in foldICmpIntrinsicWithConstant()
3856 if (C == BitWidth - 1 && Pred == ICmpInst::ICMP_UGT) in foldICmpIntrinsicWithConstant()
3860 if (C == BitWidth && Pred == ICmpInst::ICMP_ULT) in foldICmpIntrinsicWithConstant()
3867 if (Pred == ICmpInst::ICMP_UGT && C.ult(BitWidth)) { in foldICmpIntrinsicWithConstant()
3875 if (Pred == ICmpInst::ICMP_ULT && C.uge(1) && C.ule(BitWidth)) { in foldICmpIntrinsicWithConstant()
3889 if (Pred == ICmpInst::ICMP_UGT && C.ult(BitWidth)) { in foldICmpIntrinsicWithConstant()
3897 if (Pred == ICmpInst::ICMP_ULT && C.uge(1) && C.ule(BitWidth)) { in foldICmpIntrinsicWithConstant()
3907 if (ICmpInst::isSigned(Pred)) { in foldICmpIntrinsicWithConstant()
3909 return new ICmpInst(Pred, II->getArgOperand(0), II->getArgOperand(1)); in foldICmpIntrinsicWithConstant()
3911 if (Pred == ICmpInst::ICMP_SLT && C.isOne()) in foldICmpIntrinsicWithConstant()
3915 if (Pred == ICmpInst::ICMP_SGT && C.isAllOnes()) in foldICmpIntrinsicWithConstant()
3963 Instruction *InstCombinerImpl::foldSelectICmp(ICmpInst::Predicate Pred, in foldSelectICmp() argument
3969 if (Value *Res = simplifyICmpInst(Pred, Op, RHS, SQ)) in foldSelectICmp()
3972 SI->getCondition(), Pred, Op, RHS, DL, SelectCondIsTrue)) in foldSelectICmp()
4009 Op1 = Builder.CreateICmp(Pred, SI->getOperand(1), RHS, I.getName()); in foldSelectICmp()
4011 Op2 = Builder.CreateICmp(Pred, SI->getOperand(2), RHS, I.getName()); in foldSelectICmp()
4373 ICmpInst::Predicate Pred; in foldMultiplicationOverflowCheck() local
4380 match(&I, m_c_ICmp(Pred, in foldMultiplicationOverflowCheck()
4387 switch (Pred) { in foldMultiplicationOverflowCheck()
4400 m_c_ICmp(Pred, m_Value(Y), in foldMultiplicationOverflowCheck()
4407 NeedNegation = Pred == ICmpInst::Predicate::ICMP_EQ; in foldMultiplicationOverflowCheck()
4445 CmpInst::Predicate Pred; in foldICmpXNegX() local
4447 if (match(&I, m_c_ICmp(Pred, m_NSWNeg(m_Value(X)), m_Deferred(X)))) { in foldICmpXNegX()
4449 if (ICmpInst::isSigned(Pred)) in foldICmpXNegX()
4450 Pred = ICmpInst::getSwappedPredicate(Pred); in foldICmpXNegX()
4451 else if (ICmpInst::isUnsigned(Pred)) in foldICmpXNegX()
4452 Pred = ICmpInst::getSignedPredicate(Pred); in foldICmpXNegX()
4455 return ICmpInst::Create(Instruction::ICmp, Pred, X, in foldICmpXNegX()
4461 if (match(&I, m_c_ICmp(Pred, m_OneUse(m_Neg(m_Value(X))), m_Deferred(X))) && in foldICmpXNegX()
4462 ICmpInst::isEquality(Pred)) { in foldICmpXNegX()
4469 return CmpInst::Create(Instruction::ICmp, Pred, And, Zero); in foldICmpXNegX()
4479 CmpInst::Predicate Pred = I.getPredicate(); in foldICmpAndXX() local
4482 Pred = ICmpInst::getSwappedPredicate(Pred); in foldICmpAndXX()
4489 if (Pred == ICmpInst::ICMP_ULT) in foldICmpAndXX()
4493 if (Pred == ICmpInst::ICMP_UGE) in foldICmpAndXX()
4504 CmpInst::Predicate Pred = I.getPredicate(); in foldICmpOrXX() local
4507 Pred = ICmpInst::getSwappedPredicate(Pred); in foldICmpOrXX()
4513 if (Pred == ICmpInst::ICMP_ULE) in foldICmpOrXX()
4517 if (Pred == ICmpInst::ICMP_UGT) in foldICmpOrXX()
4520 if (ICmpInst::isEquality(Pred) && Op0->hasOneUse()) { in foldICmpOrXX()
4524 return new ICmpInst(Pred, IC.Builder.CreateAnd(A, NotOp1), in foldICmpOrXX()
4528 return new ICmpInst(Pred, IC.Builder.CreateOr(Op1, NotA), in foldICmpOrXX()
4538 CmpInst::Predicate Pred = I.getPredicate(); in foldICmpXorXX() local
4541 Pred = ICmpInst::getSwappedPredicate(Pred); in foldICmpXorXX()
4550 CmpInst::Predicate PredOut = CmpInst::getStrictPredicate(Pred); in foldICmpXorXX()
4551 if (PredOut != Pred && in foldICmpXorXX()
4576 const CmpInst::Predicate Pred = I.getPredicate(); in foldICmpBinOp() local
4582 (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_UGE)) in foldICmpBinOp()
4583 return new ICmpInst(Pred, Builder.CreateNot(Op1), X); in foldICmpBinOp()
4586 (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_ULE)) in foldICmpBinOp()
4587 return new ICmpInst(Pred, X, Builder.CreateNot(Op0)); in foldICmpBinOp()
4594 (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_UGE)) { in foldICmpBinOp()
4596 return new ICmpInst(Pred, Builder.CreateSub(C2, X), Op1); in foldICmpBinOp()
4601 (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_ULE)) { in foldICmpBinOp()
4603 return new ICmpInst(Pred, Op0, Builder.CreateSub(C2, X)); in foldICmpBinOp()
4615 if ((Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_UGE) && in foldICmpBinOp()
4619 Pred == ICmpInst::ICMP_ULT ? ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ; in foldICmpBinOp()
4624 if ((Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_ULE) && in foldICmpBinOp()
4628 Pred == ICmpInst::ICMP_UGT ? ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ; in foldICmpBinOp()
4639 auto hasNoWrapProblem = [](const BinaryOperator &BO, CmpInst::Predicate Pred, in foldICmpBinOp()
4644 return ICmpInst::isEquality(Pred) || in foldICmpBinOp()
4645 (CmpInst::isUnsigned(Pred) && HasNUW) || in foldICmpBinOp()
4646 (CmpInst::isSigned(Pred) && HasNSW); in foldICmpBinOp()
4659 NoOp0WrapProblem = hasNoWrapProblem(*BO0, Pred, Op0HasNSW, Op0HasNUW); in foldICmpBinOp()
4663 NoOp1WrapProblem = hasNoWrapProblem(*BO1, Pred, Op1HasNSW, Op1HasNUW); in foldICmpBinOp()
4669 return new ICmpInst(Pred, A == Op1 ? B : A, in foldICmpBinOp()
4675 return new ICmpInst(Pred, Constant::getNullValue(Op0->getType()), in foldICmpBinOp()
4701 return new ICmpInst(Pred, Y, Z); in foldICmpBinOp()
4705 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_SLT && in foldICmpBinOp()
4710 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_SGE && in foldICmpBinOp()
4715 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_SLE && match(B, m_One())) in foldICmpBinOp()
4719 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_SGT && match(B, m_One())) in foldICmpBinOp()
4723 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_SGT && in foldICmpBinOp()
4728 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_SLE && in foldICmpBinOp()
4733 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_SGE && match(D, m_One())) in foldICmpBinOp()
4737 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_SLT && match(D, m_One())) in foldICmpBinOp()
4750 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_ULE && match(B, m_One())) in foldICmpBinOp()
4754 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_UGT && match(B, m_One())) in foldICmpBinOp()
4758 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_UGE && match(D, m_One())) in foldICmpBinOp()
4762 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_ULT && match(D, m_One())) in foldICmpBinOp()
4786 return new ICmpInst(Pred, NewAdd, C); in foldICmpBinOp()
4792 return new ICmpInst(Pred, A, NewAdd); in foldICmpBinOp()
4797 ICmpInst::isEquality(Pred)) { in foldICmpBinOp()
4800 return new ICmpInst(Pred, A, NewAdd); in foldICmpBinOp()
4821 return new ICmpInst(Pred, Constant::getNullValue(Op1->getType()), B); in foldICmpBinOp()
4824 return new ICmpInst(Pred, D, Constant::getNullValue(Op0->getType())); in foldICmpBinOp()
4828 if (A == Op1 && (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_ULE)) in foldICmpBinOp()
4829 return new ICmpInst(Pred, B, A); in foldICmpBinOp()
4831 if (C == Op0 && (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_UGE)) in foldICmpBinOp()
4832 return new ICmpInst(Pred, C, D); in foldICmpBinOp()
4834 if (A == Op1 && (Pred == ICmpInst::ICMP_UGE || Pred == ICmpInst::ICMP_ULT) && in foldICmpBinOp()
4836 return new ICmpInst(CmpInst::getFlippedStrictnessPredicate(Pred), B, A); in foldICmpBinOp()
4838 if (C == Op0 && (Pred == ICmpInst::ICMP_ULE || Pred == ICmpInst::ICMP_UGT) && in foldICmpBinOp()
4840 return new ICmpInst(CmpInst::getFlippedStrictnessPredicate(Pred), C, D); in foldICmpBinOp()
4844 return new ICmpInst(Pred, A, C); in foldICmpBinOp()
4848 return new ICmpInst(Pred, D, B); in foldICmpBinOp()
4851 if (NoOp0WrapProblem && ICmpInst::isSigned(Pred)) { in foldICmpBinOp()
4869 if (Pred == ICmpInst::getUnsignedPredicate(Pred) && in foldICmpBinOp()
4875 if (ICmpInst::isEquality(Pred)) { in foldICmpBinOp()
4880 return new ICmpInst(Pred, X, Y); in foldICmpBinOp()
4886 return new ICmpInst(Pred, X, Y); in foldICmpBinOp()
4893 return new ICmpInst(Pred, X, Y); in foldICmpBinOp()
4908 switch (SRem == BO0 ? ICmpInst::getSwappedPredicate(Pred) : Pred) { in foldICmpBinOp()
4936 return new ICmpInst(Pred, BO0->getOperand(0), BO1->getOperand(0)); in foldICmpBinOp()
4970 return new ICmpInst(Pred, And1, And2); in foldICmpBinOp()
4979 return new ICmpInst(Pred, BO0->getOperand(0), BO1->getOperand(0)); in foldICmpBinOp()
4985 return new ICmpInst(Pred, BO0->getOperand(0), BO1->getOperand(0)); in foldICmpBinOp()
4990 return new ICmpInst(Pred, BO0->getOperand(0), BO1->getOperand(0)); in foldICmpBinOp()
4999 return new ICmpInst(Pred, BO0->getOperand(0), BO1->getOperand(0)); in foldICmpBinOp()
5009 if (match(BO0, BitwiseAnd) && Pred == ICmpInst::ICMP_ULT) { in foldICmpBinOp()
5018 if (!ICmpInst::isSigned(Pred)) { in foldICmpBinOp()
5020 return new ICmpInst(ICmpInst::getSignedPredicate(Pred), Op1, in foldICmpBinOp()
5023 return new ICmpInst(ICmpInst::getSignedPredicate(Pred), in foldICmpBinOp()
5049 ICmpInst::Predicate Pred) { in foldICmpWithMinMax() argument
5052 if (ICmpInst::isSigned(Pred) && !MinMax->isSigned()) in foldICmpWithMinMax()
5054 if (ICmpInst::isUnsigned(Pred) && MinMax->isSigned()) { in foldICmpWithMinMax()
5060 Pred = ICmpInst::getFlippedSignednessPredicate(Pred); in foldICmpWithMinMax()
5074 auto CmpXZ = IsCondKnownTrue(simplifyICmpInst(Pred, X, Z, Q)); in foldICmpWithMinMax()
5075 auto CmpYZ = IsCondKnownTrue(simplifyICmpInst(Pred, Y, Z, Q)); in foldICmpWithMinMax()
5086 return ICmpInst::Create(Instruction::ICmp, Pred, Y, Z); in foldICmpWithMinMax()
5089 switch (Pred) { in foldICmpWithMinMax()
5098 if ((Pred == ICmpInst::ICMP_EQ) == *CmpXZ) { in foldICmpWithMinMax()
5101 if (Pred == ICmpInst::ICMP_NE) in foldICmpWithMinMax()
5112 if (!CmpXZ.has_value() || (Pred == ICmpInst::ICMP_EQ) == *CmpXZ) in foldICmpWithMinMax()
5125 I, ConstantInt::getBool(I.getType(), Pred == ICmpInst::ICMP_NE)); in foldICmpWithMinMax()
5144 bool IsSame = MinMax->getPredicate() == ICmpInst::getStrictPredicate(Pred); in foldICmpWithMinMax()
5191 const CmpInst::Predicate Pred = I.getPredicate(); in foldICmpPow2Test() local
5210 CheckIs = Pred == ICmpInst::ICMP_EQ; in foldICmpPow2Test()
5211 } else if (ICmpInst::isUnsigned(Pred)) { in foldICmpPow2Test()
5215 if ((Pred == ICmpInst::ICMP_UGE || Pred == ICmpInst::ICMP_ULT) && in foldICmpPow2Test()
5219 CheckIs = Pred == ICmpInst::ICMP_UGE; in foldICmpPow2Test()
5220 } else if ((Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_ULE) && in foldICmpPow2Test()
5224 CheckIs = Pred == ICmpInst::ICMP_ULE; in foldICmpPow2Test()
5245 const CmpInst::Predicate Pred = I.getPredicate(); in foldICmpEquality() local
5250 return new ICmpInst(Pred, OtherVal, Constant::getNullValue(A->getType())); in foldICmpEquality()
5260 return new ICmpInst(Pred, A, Xor); in foldICmpEquality()
5265 return new ICmpInst(Pred, B, D); in foldICmpEquality()
5267 return new ICmpInst(Pred, B, C); in foldICmpEquality()
5269 return new ICmpInst(Pred, A, D); in foldICmpEquality()
5271 return new ICmpInst(Pred, A, C); in foldICmpEquality()
5286 return new ICmpInst(Pred, Builder.CreateAnd(A, Builder.CreateNot(CMask)), in foldICmpEquality()
5293 return new ICmpInst(Pred, OtherVal, Constant::getNullValue(A->getType())); in foldICmpEquality()
5322 return new ICmpInst(Pred, Op1, Constant::getNullValue(Op1->getType())); in foldICmpEquality()
5335 return new ICmpInst(Pred, And, Constant::getNullValue(And->getType())); in foldICmpEquality()
5346 return new ICmpInst(Pred, A, Builder.CreateTrunc(B, A->getType())); in foldICmpEquality()
5362 Pred == ICmpInst::ICMP_NE ? ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT; in foldICmpEquality()
5380 return new ICmpInst(Pred, And, Constant::getNullValue(Cst1->getType())); in foldICmpEquality()
5404 return new ICmpInst(Pred, Mask, Builder.getInt(CmpV)); in foldICmpEquality()
5422 return new ICmpInst(Pred == ICmpInst::ICMP_EQ ? ICmpInst::ICMP_ULT in foldICmpEquality()
5433 return new ICmpInst(CmpInst::getInversePredicate(Pred), Op0, in foldICmpEquality()
5438 return new ICmpInst(CmpInst::getInversePredicate(Pred), Op1, in foldICmpEquality()
5446 CmpInst::Predicate PredUnused = Pred; in foldICmpEquality()
5451 Pred, A, in foldICmpEquality()
5460 return new ICmpInst(Pred, Builder.CreateXor(A, B), Cst); in foldICmpEquality()
5483 return new ICmpInst(Pred, Builder.CreateAnd(B, A), in foldICmpEquality()
5492 ICmpInst::Predicate Pred = ICmp.getPredicate(); in foldICmpWithTrunc() local
5506 if (decomposeBitTestICmp(Op0, Op1, Pred, X, Mask, true /* WithTrunc */)) { in foldICmpWithTrunc()
5509 return new ICmpInst(Pred, And, Zero); in foldICmpWithTrunc()
5513 if (Pred == ICmpInst::ICMP_ULT && C->isNegatedPowerOf2()) { in foldICmpWithTrunc()
5521 if (Pred == ICmpInst::ICMP_UGT && (~*C).isPowerOf2()) { in foldICmpWithTrunc()
6108 ICmpInst::Predicate Pred = I.getPredicate(); in foldICmpUsingKnownBits() local
6156 return new ICmpInst(Pred, ConstantExpr::getIntegerValue(Ty, Op0Min), Op1); in foldICmpUsingKnownBits()
6158 return new ICmpInst(Pred, Op0, ConstantExpr::getIntegerValue(Ty, Op1Min)); in foldICmpUsingKnownBits()
6175 switch (Pred) { in foldICmpUsingKnownBits()
6239 switch (Pred) { in foldICmpUsingKnownBits()
6246 I, ConstantInt::getBool(I.getType(), Pred == CmpInst::ICMP_NE)); in foldICmpUsingKnownBits()
6274 Pred == CmpInst::ICMP_EQ ? CmpInst::ICMP_UGE : CmpInst::ICMP_ULT; in foldICmpUsingKnownBits()
6283 return new ICmpInst(CmpInst::getInversePredicate(Pred), Op0, in foldICmpUsingKnownBits()
6367 ICmpInst::Predicate Pred; in foldICmpUsingBoolRange() local
6371 if (match(&I, m_c_ICmp(Pred, m_Value(X), m_OneUse(m_ZExt(m_Value(Y))))) && in foldICmpUsingBoolRange()
6372 Y->getType()->isIntOrIntVectorTy(1) && Pred == ICmpInst::ICMP_ULT) in foldICmpUsingBoolRange()
6377 if (match(&I, m_c_ICmp(Pred, m_Value(X), m_OneUse(m_SExt(m_Value(Y))))) && in foldICmpUsingBoolRange()
6378 Y->getType()->isIntOrIntVectorTy(1) && Pred == ICmpInst::ICMP_ULE) in foldICmpUsingBoolRange()
6452 InstCombiner::getFlippedStrictnessPredicateAndConstant(CmpInst::Predicate Pred, in getFlippedStrictnessPredicateAndConstant() argument
6454 assert(ICmpInst::isRelational(Pred) && ICmpInst::isIntPredicate(Pred) && in getFlippedStrictnessPredicateAndConstant()
6458 bool IsSigned = ICmpInst::isSigned(Pred); in getFlippedStrictnessPredicateAndConstant()
6460 CmpInst::Predicate UnsignedPred = ICmpInst::getUnsignedPredicate(Pred); in getFlippedStrictnessPredicateAndConstant()
6515 CmpInst::Predicate NewPred = CmpInst::getFlippedStrictnessPredicate(Pred); in getFlippedStrictnessPredicateAndConstant()
6528 ICmpInst::Predicate Pred = I.getPredicate(); in canonicalizeCmpWithConstant() local
6529 if (ICmpInst::isEquality(Pred) || !ICmpInst::isIntPredicate(Pred) || in canonicalizeCmpWithConstant()
6530 InstCombiner::isCanonicalPredicate(Pred)) in canonicalizeCmpWithConstant()
6540 InstCombiner::getFlippedStrictnessPredicateAndConstant(Pred, Op1C); in canonicalizeCmpWithConstant()
6551 CmpInst::Predicate Pred = I.getPredicate(); in canonicalizeICmpPredicate() local
6552 if (InstCombiner::isCanonicalPredicate(Pred)) in canonicalizeICmpPredicate()
6561 I.setPredicate(CmpInst::getInversePredicate(Pred)); in canonicalizeICmpPredicate()
6652 ICmpInst::Predicate Pred, NewPred; in foldICmpWithHighBitMask() local
6655 m_c_ICmp(Pred, m_OneUse(m_Shl(m_One(), m_Value(Y))), m_Value(X)))) { in foldICmpWithHighBitMask()
6656 switch (Pred) { in foldICmpWithHighBitMask()
6666 } else if (match(&Cmp, m_c_ICmp(Pred, in foldICmpWithHighBitMask()
6675 switch (Pred) { in foldICmpWithHighBitMask()
6695 const CmpInst::Predicate Pred = Cmp.getPredicate(); in foldVectorCmp() local
6699 auto createCmpReverse = [&](CmpInst::Predicate Pred, Value *X, Value *Y) { in foldVectorCmp() argument
6700 Value *V = Builder.CreateCmp(Pred, X, Y, Cmp.getName()); in foldVectorCmp()
6713 return createCmpReverse(Pred, V1, V2); in foldVectorCmp()
6717 return createCmpReverse(Pred, V1, RHS); in foldVectorCmp()
6721 return createCmpReverse(Pred, LHS, V2); in foldVectorCmp()
6733 Value *NewCmp = Builder.CreateCmp(Pred, V1, V2); in foldVectorCmp()
6754 Value *NewCmp = Builder.CreateCmp(Pred, V1, C); in foldVectorCmp()
6764 CmpInst::Predicate Pred = I.getPredicate(); in foldICmpOfUAddOv() local
6772 ((Pred == ICmpInst::ICMP_ULT && (Op1 == A || Op1 == B)) || in foldICmpOfUAddOv()
6773 (Pred == ICmpInst::ICMP_EQ && match(Op1, m_ZeroInt()) && in foldICmpOfUAddOv()
6775 (Pred == ICmpInst::ICMP_NE && match(Op1, m_AllOnes()) && in foldICmpOfUAddOv()
6782 Pred == ICmpInst::ICMP_UGT && (Op0 == A || Op0 == B)) in foldICmpOfUAddOv()
6858 Instruction *InstCombinerImpl::foldICmpCommutative(ICmpInst::Predicate Pred, in foldICmpCommutative() argument
6863 if (Instruction *NI = foldGEPICmp(GEP, Op1, Pred, CxtI)) in foldICmpCommutative()
6867 if (Instruction *NI = foldSelectICmp(Pred, SI, Op1, CxtI)) in foldICmpCommutative()
6871 if (Instruction *Res = foldICmpWithMinMax(CxtI, MinMax, Op1, Pred)) in foldICmpCommutative()
6879 return foldICmpAddOpConst(X, *C, Pred); in foldICmpCommutative()
6902 switch (Pred) { in foldICmpCommutative()
7023 ICmpInst::Predicate Pred = I.getPredicate(); in visitICmpInst() local
7027 if (Pred == ICmpInst::ICMP_UGT && C->isMaxSignedValue()) { in visitICmpInst()
7033 if (Pred == ICmpInst::ICMP_ULT && C->isMinSignedValue()) { in visitICmpInst()
7084 if (Value *Res = simplifyICmpInst(Pred, A, C, SQ)) { in visitICmpInst()
7085 Value *NewICMP = Builder.CreateICmp(Pred, B, D); in visitICmpInst()
7089 if (Value *Res = simplifyICmpInst(Pred, B, D, SQ)) { in visitICmpInst()
7090 Value *NewICMP = Builder.CreateICmp(Pred, A, C); in visitICmpInst()
7183 Value *Cmp = Builder.CreateICmp(Pred, SLTZero, Y, I.getName()); in visitICmpInst()
7302 ICmpInst::Predicate Pred; in foldFCmpIntToFPConst() local
7307 Pred = ICmpInst::ICMP_EQ; in foldFCmpIntToFPConst()
7311 Pred = LHSUnsigned ? ICmpInst::ICMP_UGT : ICmpInst::ICMP_SGT; in foldFCmpIntToFPConst()
7315 Pred = LHSUnsigned ? ICmpInst::ICMP_UGE : ICmpInst::ICMP_SGE; in foldFCmpIntToFPConst()
7319 Pred = LHSUnsigned ? ICmpInst::ICMP_ULT : ICmpInst::ICMP_SLT; in foldFCmpIntToFPConst()
7323 Pred = LHSUnsigned ? ICmpInst::ICMP_ULE : ICmpInst::ICMP_SLE; in foldFCmpIntToFPConst()
7327 Pred = ICmpInst::ICMP_NE; in foldFCmpIntToFPConst()
7348 if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SLT || in foldFCmpIntToFPConst()
7349 Pred == ICmpInst::ICMP_SLE) in foldFCmpIntToFPConst()
7360 if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_ULT || in foldFCmpIntToFPConst()
7361 Pred == ICmpInst::ICMP_ULE) in foldFCmpIntToFPConst()
7373 if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SGT || in foldFCmpIntToFPConst()
7374 Pred == ICmpInst::ICMP_SGE) in foldFCmpIntToFPConst()
7384 if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_UGT || in foldFCmpIntToFPConst()
7385 Pred == ICmpInst::ICMP_UGE) in foldFCmpIntToFPConst()
7403 switch (Pred) { in foldFCmpIntToFPConst()
7419 Pred = ICmpInst::ICMP_SLT; in foldFCmpIntToFPConst()
7426 Pred = ICmpInst::ICMP_ULE; in foldFCmpIntToFPConst()
7432 Pred = ICmpInst::ICMP_SLE; in foldFCmpIntToFPConst()
7444 Pred = ICmpInst::ICMP_SGE; in foldFCmpIntToFPConst()
7451 Pred = ICmpInst::ICMP_UGT; in foldFCmpIntToFPConst()
7457 Pred = ICmpInst::ICMP_SGT; in foldFCmpIntToFPConst()
7465 return new ICmpInst(Pred, LHSI->getOperand(0), Builder.getInt(RHSInt)); in foldFCmpIntToFPConst()
7484 FCmpInst::Predicate Pred = I.getPredicate(); in foldFCmpReciprocalAndZero() local
7487 if ((Pred != FCmpInst::FCMP_OGT) && (Pred != FCmpInst::FCMP_OLT) && in foldFCmpReciprocalAndZero()
7488 (Pred != FCmpInst::FCMP_OGE) && (Pred != FCmpInst::FCMP_OLE)) in foldFCmpReciprocalAndZero()
7510 Pred = I.getSwappedPredicate(); in foldFCmpReciprocalAndZero()
7512 return new FCmpInst(Pred, LHSI->getOperand(1), RHSC, "", &I); in foldFCmpReciprocalAndZero()
7617 CmpInst::Predicate Pred = I.getPredicate(); in foldFCmpFNegCommonOp() local
7623 Pred = I.getSwappedPredicate(); in foldFCmpFNegCommonOp()
7632 return new FCmpInst(Pred, Op0, Zero, "", &I); in foldFCmpFNegCommonOp()
7646 const CmpInst::Predicate Pred = I.getPredicate(); in visitFCmpInst() local
7648 if (Value *V = simplifyFCmpInst(Pred, Op0, Op1, I.getFastMathFlags(), in visitFCmpInst()
7656 switch (Pred) { in visitFCmpInst()
7680 if (Pred == CmpInst::FCMP_ORD || Pred == CmpInst::FCMP_UNO) { in visitFCmpInst()
7725 if (Pred == FCmpInst::FCMP_OEQ) in visitFCmpInst()
7727 else if (Pred == FCmpInst::FCMP_UNE) in visitFCmpInst()
7780 return new FCmpInst(Pred, X, Y, "", &I); in visitFCmpInst()
7794 switch (Pred) { in visitFCmpInst()
7822 return new FCmpInst(Pred, X, NewC, "", &I); in visitFCmpInst()
7840 if (Pred == FCmpInst::FCMP_OLT) { in visitFCmpInst()
7854 return new FCmpInst(Pred, Op1, Op1, "", &I); in visitFCmpInst()
7858 return new FCmpInst(Pred, Op0, Op0, "", &I); in visitFCmpInst()
7862 return new FCmpInst(Pred, CanonLHS, CanonRHS, "", &I); in visitFCmpInst()