Lines Matching refs:Cmp

774         Value *Cmp = Builder.CreateICmp(ICmpInst::getSignedPredicate(Cond),  in foldGEPICmp()  local
776 return replaceInstUsesWith(I, Cmp); in foldGEPICmp()
1202 Instruction *InstCombinerImpl::foldICmpWithZero(ICmpInst &Cmp) { in foldICmpWithZero() argument
1203 CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpWithZero()
1204 if (!match(Cmp.getOperand(1), m_Zero())) in foldICmpWithZero()
1210 if (match(Cmp.getOperand(0), m_SMin(m_Value(A), m_Value(B)))) { in foldICmpWithZero()
1211 if (isKnownPositive(A, SQ.getWithInstruction(&Cmp))) in foldICmpWithZero()
1212 return new ICmpInst(Pred, B, Cmp.getOperand(1)); in foldICmpWithZero()
1213 if (isKnownPositive(B, SQ.getWithInstruction(&Cmp))) in foldICmpWithZero()
1214 return new ICmpInst(Pred, A, Cmp.getOperand(1)); in foldICmpWithZero()
1218 if (Instruction *New = foldIRemByPowerOfTwoToBitTest(Cmp)) in foldICmpWithZero()
1226 if (match(Cmp.getOperand(0), m_URem(m_Value(X), m_Value(Y))) && in foldICmpWithZero()
1228 KnownBits XKnown = computeKnownBits(X, 0, &Cmp); in foldICmpWithZero()
1229 KnownBits YKnown = computeKnownBits(Y, 0, &Cmp); in foldICmpWithZero()
1231 return new ICmpInst(Pred, X, Cmp.getOperand(1)); in foldICmpWithZero()
1236 if (match(Cmp.getOperand(0), m_Mul(m_Value(X), m_Value(Y))) && in foldICmpWithZero()
1239 KnownBits XKnown = computeKnownBits(X, 0, &Cmp); in foldICmpWithZero()
1243 return new ICmpInst(Pred, Y, Cmp.getOperand(1)); in foldICmpWithZero()
1245 KnownBits YKnown = computeKnownBits(Y, 0, &Cmp); in foldICmpWithZero()
1249 return new ICmpInst(Pred, X, Cmp.getOperand(1)); in foldICmpWithZero()
1251 auto *BO0 = cast<OverflowingBinaryOperator>(Cmp.getOperand(0)); in foldICmpWithZero()
1253 const SimplifyQuery Q = SQ.getWithInstruction(&Cmp); in foldICmpWithZero()
1260 return new ICmpInst(Pred, Y, Cmp.getOperand(1)); in foldICmpWithZero()
1265 return new ICmpInst(Pred, X, Cmp.getOperand(1)); in foldICmpWithZero()
1284 Instruction *InstCombinerImpl::foldICmpWithConstant(ICmpInst &Cmp) { in foldICmpWithConstant() argument
1296 CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpWithConstant()
1297 Value *Op0 = Cmp.getOperand(0), *Op1 = Cmp.getOperand(1); in foldICmpWithConstant()
1302 if (Instruction *Res = processUGT_ADDCST_ADD(Cmp, A, B, CI2, CI, *this)) in foldICmpWithConstant()
1321 PHINode *NewPhi = Builder.CreatePHI(Cmp.getType(), Phi->getNumOperands()); in foldICmpWithConstant()
1324 return replaceInstUsesWith(Cmp, NewPhi); in foldICmpWithConstant()
1327 if (Instruction *R = tryFoldInstWithCtpopWithNot(&Cmp)) in foldICmpWithConstant()
1334 Instruction *InstCombinerImpl::foldICmpWithDominatingICmp(ICmpInst &Cmp) { in foldICmpWithDominatingICmp() argument
1337 Value *X = Cmp.getOperand(0), *Y = Cmp.getOperand(1); in foldICmpWithDominatingICmp()
1342 CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpWithDominatingICmp()
1359 return replaceInstUsesWith(Cmp, Builder.getFalse()); in foldICmpWithDominatingICmp()
1361 return replaceInstUsesWith(Cmp, Builder.getTrue()); in foldICmpWithDominatingICmp()
1370 if (Cmp.isEquality() || (IsSignBit && hasBranchUse(Cmp))) in foldICmpWithDominatingICmp()
1375 if (Cmp.hasOneUse() && in foldICmpWithDominatingICmp()
1376 match(Cmp.user_back(), m_MaxOrMin(m_Value(), m_Value()))) in foldICmpWithDominatingICmp()
1394 if (DT.dominates(Edge0, Cmp.getParent())) { in foldICmpWithDominatingICmp()
1399 if (DT.dominates(Edge1, Cmp.getParent())) in foldICmpWithDominatingICmp()
1410 Instruction *InstCombinerImpl::foldICmpTruncConstant(ICmpInst &Cmp, in foldICmpTruncConstant() argument
1413 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpTruncConstant()
1424 if (!Cmp.isSigned() && Trunc->hasNoUnsignedWrap()) in foldICmpTruncConstant()
1439 if (Cmp.isEquality() && match(X, m_Shl(m_One(), m_Value(Y)))) { in foldICmpTruncConstant()
1443 auto NewPred = (Pred == Cmp.ICMP_EQ) ? Cmp.ICMP_UGE : Cmp.ICMP_ULT; in foldICmpTruncConstant()
1452 if (Cmp.isEquality() && Trunc->hasOneUse()) { in foldICmpTruncConstant()
1465 KnownBits Known = computeKnownBits(X, 0, &Cmp); in foldICmpTruncConstant()
1497 InstCombinerImpl::foldICmpTruncWithTruncOrExt(ICmpInst &Cmp, in foldICmpTruncWithTruncOrExt() argument
1503 if (match(&Cmp, m_ICmp(Pred, m_Trunc(m_Value(X)), m_Trunc(m_Value(Y))))) { in foldICmpTruncWithTruncOrExt()
1504 unsigned NoWrapFlags = cast<TruncInst>(Cmp.getOperand(0))->getNoWrapKind() & in foldICmpTruncWithTruncOrExt()
1505 cast<TruncInst>(Cmp.getOperand(1))->getNoWrapKind(); in foldICmpTruncWithTruncOrExt()
1506 if (Cmp.isSigned()) { in foldICmpTruncWithTruncOrExt()
1518 (!Cmp.getOperand(0)->hasOneUse() || !Cmp.getOperand(1)->hasOneUse())) in foldICmpTruncWithTruncOrExt()
1523 Pred = Cmp.getSwappedPredicate(Pred); in foldICmpTruncWithTruncOrExt()
1528 else if (!Cmp.isSigned() && in foldICmpTruncWithTruncOrExt()
1529 match(&Cmp, m_c_ICmp(Pred, m_NUWTrunc(m_Value(X)), in foldICmpTruncWithTruncOrExt()
1534 else if (match(&Cmp, m_c_ICmp(Pred, m_NSWTrunc(m_Value(X)), in foldICmpTruncWithTruncOrExt()
1538 isa<SExtInst>(Cmp.getOperand(0)) || isa<SExtInst>(Cmp.getOperand(1)); in foldICmpTruncWithTruncOrExt()
1542 Type *TruncTy = Cmp.getOperand(0)->getType(); in foldICmpTruncWithTruncOrExt()
1556 Instruction *InstCombinerImpl::foldICmpXorConstant(ICmpInst &Cmp, in foldICmpXorConstant() argument
1559 if (Instruction *I = foldICmpXorShiftConst(Cmp, Xor, C)) in foldICmpXorConstant()
1570 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpXorConstant()
1572 if (isSignBitCheck(Cmp.getPredicate(), C, TrueIfSigned)) { in foldICmpXorConstant()
1577 return replaceOperand(Cmp, 0, X); in foldICmpXorConstant()
1590 if (!Cmp.isEquality() && XorC->isSignMask()) { in foldICmpXorConstant()
1591 Pred = Cmp.getFlippedSignednessPredicate(); in foldICmpXorConstant()
1596 if (!Cmp.isEquality() && XorC->isMaxSignedValue()) { in foldICmpXorConstant()
1597 Pred = Cmp.getFlippedSignednessPredicate(); in foldICmpXorConstant()
1598 Pred = Cmp.getSwappedPredicate(Pred); in foldICmpXorConstant()
1628 Instruction *InstCombinerImpl::foldICmpXorShiftConst(ICmpInst &Cmp, in foldICmpXorShiftConst() argument
1631 CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpXorShiftConst()
1657 Instruction *InstCombinerImpl::foldICmpAndShift(ICmpInst &Cmp, in foldICmpAndShift() argument
1681 if (Cmp.isSigned() && (C2.isNegative() || C1.isNegative())) in foldICmpAndShift()
1695 if (Cmp.isSigned() && (NewAndCst.isNegative() || NewCmpCst.isNegative())) in foldICmpAndShift()
1712 if (Cmp.getPredicate() == ICmpInst::ICMP_EQ) in foldICmpAndShift()
1713 return replaceInstUsesWith(Cmp, ConstantInt::getFalse(Cmp.getType())); in foldICmpAndShift()
1714 if (Cmp.getPredicate() == ICmpInst::ICMP_NE) in foldICmpAndShift()
1715 return replaceInstUsesWith(Cmp, ConstantInt::getTrue(Cmp.getType())); in foldICmpAndShift()
1719 return new ICmpInst(Cmp.getPredicate(), in foldICmpAndShift()
1727 if (Shift->hasOneUse() && C1.isZero() && Cmp.isEquality() && in foldICmpAndShift()
1736 return replaceOperand(Cmp, 0, NewAnd); in foldICmpAndShift()
1743 Instruction *InstCombinerImpl::foldICmpAndConstConst(ICmpInst &Cmp, in foldICmpAndConstConst() argument
1746 bool isICMP_NE = Cmp.getPredicate() == ICmpInst::ICMP_NE; in foldICmpAndConstConst()
1751 if (isICMP_NE && Cmp.getType()->isVectorTy() && C1.isZero() && in foldICmpAndConstConst()
1753 return new TruncInst(And->getOperand(0), Cmp.getType()); in foldICmpAndConstConst()
1764 if (Cmp.isEquality() && C1.isZero()) { in foldICmpAndConstConst()
1798 (Cmp.isEquality() || (!C1.isNegative() && !C2->isNegative()))) { in foldICmpAndConstConst()
1802 if (!Cmp.getType()->isVectorTy()) { in foldICmpAndConstConst()
1808 return new ICmpInst(Cmp.getPredicate(), NewAnd, ZextC1); in foldICmpAndConstConst()
1812 if (Instruction *I = foldICmpAndShift(Cmp, And, C1, *C2)) in foldICmpAndConstConst()
1819 if (!Cmp.isSigned() && C1.isZero() && And->getOperand(0)->hasOneUse() && in foldICmpAndConstConst()
1842 return replaceOperand(Cmp, 0, NewAnd); in foldICmpAndConstConst()
1852 if (!Cmp.getParent()->getParent()->hasFnAttribute( in foldICmpAndConstConst()
1854 Cmp.isEquality() && in foldICmpAndConstConst()
1864 return replaceInstUsesWith(Cmp, Builder.createIsFPClass(V, Mask)); in foldICmpAndConstConst()
1873 Instruction *InstCombinerImpl::foldICmpAndConstant(ICmpInst &Cmp, in foldICmpAndConstant() argument
1876 if (Instruction *I = foldICmpAndConstConst(Cmp, And, C)) in foldICmpAndConstant()
1879 const ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpAndConstant()
1911 foldCmpLoadFromIndexedGlobal(LI, GEP, GV, Cmp, C2)) in foldICmpAndConstant()
1914 if (!Cmp.isEquality()) in foldICmpAndConstant()
1920 if (Cmp.getOperand(1) == Y && C.isNegatedPowerOf2()) { in foldICmpAndConstant()
1923 return new ICmpInst(NewPred, X, SubOne(cast<Constant>(Cmp.getOperand(1)))); in foldICmpAndConstant()
1936 assert(Cmp.isEquality() && "Not expecting non-equality predicates"); in foldICmpAndConstant()
1946 return replaceInstUsesWith(Cmp, R); in foldICmpAndConstant()
1979 static Value *foldICmpOrXorSubChain(ICmpInst &Cmp, BinaryOperator *Or, in foldICmpOrXorSubChain() argument
2024 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpOrXorSubChain()
2038 Instruction *InstCombinerImpl::foldICmpOrConstant(ICmpInst &Cmp, in foldICmpOrConstant() argument
2041 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpOrConstant()
2054 if (Cmp.isEquality() && match(OrOp1, m_ImmConstant()) && in foldICmpOrConstant()
2062 if (match(OrOp1, m_APInt(MaskC)) && Cmp.isEquality()) { in foldICmpOrConstant()
2117 if (!Cmp.isEquality() || !C.isZero() || !Or->hasOneUse()) in foldICmpOrConstant()
2132 if (Value *V = foldICmpOrXorSubChain(Cmp, Or, Builder)) in foldICmpOrConstant()
2133 return replaceInstUsesWith(Cmp, V); in foldICmpOrConstant()
2139 Instruction *InstCombinerImpl::foldICmpMulConstant(ICmpInst &Cmp, in foldICmpMulConstant() argument
2142 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpMulConstant()
2149 if (Cmp.isEquality() && C.isZero() && X == Mul->getOperand(1) && in foldICmpMulConstant()
2172 if (Cmp.isEquality()) { in foldICmpMulConstant()
2230 static Instruction *foldICmpShlOne(ICmpInst &Cmp, Instruction *Shl, in foldICmpShlOne() argument
2239 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpShlOne()
2240 if (Cmp.isUnsigned()) { in foldICmpShlOne()
2255 } else if (Cmp.isSigned()) { in foldICmpShlOne()
2274 Instruction *InstCombinerImpl::foldICmpShlConstant(ICmpInst &Cmp, in foldICmpShlConstant() argument
2278 if (Cmp.isEquality() && match(Shl->getOperand(0), m_APInt(ShiftVal))) in foldICmpShlConstant()
2279 return foldICmpShlConstConst(Cmp, Shl->getOperand(1), C, *ShiftVal); in foldICmpShlConstant()
2281 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpShlConstant()
2288 return new ICmpInst(Pred, Shl->getOperand(0), Cmp.getOperand(1)); in foldICmpShlConstant()
2294 return new ICmpInst(Pred, Shl->getOperand(0), Cmp.getOperand(1)); in foldICmpShlConstant()
2305 return new ICmpInst(Pred, Shl->getOperand(0), Cmp.getOperand(1)); in foldICmpShlConstant()
2309 return foldICmpShlOne(Cmp, Shl, C); in foldICmpShlConstant()
2370 if (Cmp.isEquality() && Shl->hasOneUse()) { in foldICmpShlConstant()
2393 if (Cmp.isUnsigned() && Shl->hasOneUse()) { in foldICmpShlConstant()
2455 Instruction *InstCombinerImpl::foldICmpShrConstant(ICmpInst &Cmp, in foldICmpShrConstant() argument
2461 CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpShrConstant()
2462 if (Cmp.isEquality() && Shr->isExact() && C.isZero()) in foldICmpShrConstant()
2463 return new ICmpInst(Pred, X, Cmp.getOperand(1)); in foldICmpShrConstant()
2468 if (Cmp.isEquality()) in foldICmpShrConstant()
2469 return foldICmpShrConstConst(Cmp, Shr->getOperand(1), C, *ShiftValC); in foldICmpShrConstant()
2580 if (!Cmp.isEquality()) in foldICmpShrConstant()
2619 Instruction *InstCombinerImpl::foldICmpSRemConstant(ICmpInst &Cmp, in foldICmpSRemConstant() argument
2625 const ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpSRemConstant()
2670 Instruction *InstCombinerImpl::foldICmpUDivConstant(ICmpInst &Cmp, in foldICmpUDivConstant() argument
2673 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpUDivConstant()
2703 Instruction *InstCombinerImpl::foldICmpDivConstant(ICmpInst &Cmp, in foldICmpDivConstant() argument
2706 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpDivConstant()
2720 if (Cmp.isEquality() && Div->hasOneUse() && C.isSignBitSet() && in foldICmpDivConstant()
2746 if (!Cmp.isEquality() && DivIsSigned != Cmp.isSigned()) in foldICmpDivConstant()
2843 return replaceInstUsesWith(Cmp, Builder.getFalse()); in foldICmpDivConstant()
2851 Cmp, insertRangeTest(X, LoBound, HiBound, DivIsSigned, true)); in foldICmpDivConstant()
2854 return replaceInstUsesWith(Cmp, Builder.getTrue()); in foldICmpDivConstant()
2862 Cmp, insertRangeTest(X, LoBound, HiBound, DivIsSigned, false)); in foldICmpDivConstant()
2866 return replaceInstUsesWith(Cmp, Builder.getTrue()); in foldICmpDivConstant()
2868 return replaceInstUsesWith(Cmp, Builder.getFalse()); in foldICmpDivConstant()
2873 return replaceInstUsesWith(Cmp, Builder.getFalse()); in foldICmpDivConstant()
2875 return replaceInstUsesWith(Cmp, Builder.getTrue()); in foldICmpDivConstant()
2885 Instruction *InstCombinerImpl::foldICmpSubConstant(ICmpInst &Cmp, in foldICmpSubConstant() argument
2889 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpSubConstant()
2895 if (Cmp.isEquality() && match(X, m_ImmConstant(SubC))) { in foldICmpSubConstant()
2903 ICmpInst::Predicate SwappedPred = Cmp.getSwappedPredicate(); in foldICmpSubConstant()
2907 ((Cmp.isUnsigned() && HasNUW) || (Cmp.isSigned() && HasNSW)) && in foldICmpSubConstant()
2908 !subWithOverflow(SubResult, *C2, C, Cmp.isSigned())) in foldICmpSubConstant()
2917 if (Cmp.isEquality() && C.isZero() && in foldICmpSubConstant()
3020 Instruction *InstCombinerImpl::foldICmpAddConstant(ICmpInst &Cmp, in foldICmpAddConstant() argument
3028 const CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpAddConstant()
3052 return replaceInstUsesWith(Cmp, Cond); in foldICmpAddConstant()
3055 if (Cmp.isEquality() || !match(Y, m_APInt(C2))) in foldICmpAddConstant()
3070 Cmp.isSigned() ? C.ssub_ov(*C2, Overflow) : C.usub_ov(*C2, Overflow); in foldICmpAddConstant()
3082 if (Cmp.isSigned()) { in foldICmpAddConstant()
3118 const SimplifyQuery Q = SQ.getWithInstruction(&Cmp); in foldICmpAddConstant()
3212 Instruction *InstCombinerImpl::foldICmpSelectConstant(ICmpInst &Cmp, in foldICmpSelectConstant() argument
3224 if (Cmp.hasOneUse() && in foldICmpSelectConstant()
3230 C1LessThan->getValue(), C->getValue(), Cmp.getPredicate()); in foldICmpSelectConstant()
3232 Cmp.getPredicate()); in foldICmpSelectConstant()
3234 C3GreaterThan->getValue(), C->getValue(), Cmp.getPredicate()); in foldICmpSelectConstant()
3255 return replaceInstUsesWith(Cmp, Cond); in foldICmpSelectConstant()
3260 Instruction *InstCombinerImpl::foldICmpBitCast(ICmpInst &Cmp) { in foldICmpBitCast() argument
3261 auto *Bitcast = dyn_cast<BitCastInst>(Cmp.getOperand(0)); in foldICmpBitCast()
3265 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpBitCast()
3266 Value *Op1 = Cmp.getOperand(1); in foldICmpBitCast()
3301 if (Cmp.isEquality() && match(Op1, m_Zero())) in foldICmpBitCast()
3335 if (!Cmp.getParent()->getParent()->hasFnAttribute( in foldICmpBitCast()
3337 Cmp.isEquality() && FPType->isIEEELikeFPTy()) { in foldICmpBitCast()
3342 return replaceInstUsesWith(Cmp, in foldICmpBitCast()
3350 if (!match(Cmp.getOperand(1), m_APInt(C)) || !DstType->isIntegerTy() || in foldICmpBitCast()
3361 if (Cmp.isEquality() && C->isAllOnes() && Bitcast->hasOneUse()) { in foldICmpBitCast()
3373 if (Cmp.isEquality() && C->isZero() && Bitcast->hasOneUse() && in foldICmpBitCast()
3414 Instruction *InstCombinerImpl::foldICmpInstWithConstant(ICmpInst &Cmp) { in foldICmpInstWithConstant() argument
3417 if (match(Cmp.getOperand(1), m_APInt(C))) { in foldICmpInstWithConstant()
3418 if (auto *BO = dyn_cast<BinaryOperator>(Cmp.getOperand(0))) in foldICmpInstWithConstant()
3419 if (Instruction *I = foldICmpBinOpWithConstant(Cmp, BO, *C)) in foldICmpInstWithConstant()
3422 if (auto *SI = dyn_cast<SelectInst>(Cmp.getOperand(0))) in foldICmpInstWithConstant()
3426 if (auto *ConstRHS = dyn_cast<ConstantInt>(Cmp.getOperand(1))) in foldICmpInstWithConstant()
3427 if (Instruction *I = foldICmpSelectConstant(Cmp, SI, ConstRHS)) in foldICmpInstWithConstant()
3430 if (auto *TI = dyn_cast<TruncInst>(Cmp.getOperand(0))) in foldICmpInstWithConstant()
3431 if (Instruction *I = foldICmpTruncConstant(Cmp, TI, *C)) in foldICmpInstWithConstant()
3434 if (auto *II = dyn_cast<IntrinsicInst>(Cmp.getOperand(0))) in foldICmpInstWithConstant()
3435 if (Instruction *I = foldICmpIntrinsicWithConstant(Cmp, II, *C)) in foldICmpInstWithConstant()
3441 Value *Cmp0 = Cmp.getOperand(0); in foldICmpInstWithConstant()
3443 if (C->isZero() && Cmp.isEquality() && Cmp0->hasOneUse() && in foldICmpInstWithConstant()
3450 return new ICmpInst(Cmp.getPredicate(), X, Y); in foldICmpInstWithConstant()
3453 if (match(Cmp.getOperand(1), m_APIntAllowPoison(C))) in foldICmpInstWithConstant()
3454 return foldICmpInstWithConstantAllowPoison(Cmp, *C); in foldICmpInstWithConstant()
3462 ICmpInst &Cmp, BinaryOperator *BO, const APInt &C) { in foldICmpBinOpEqualityWithConstant() argument
3465 if (!Cmp.isEquality()) in foldICmpBinOpEqualityWithConstant()
3468 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpBinOpEqualityWithConstant()
3470 Constant *RHS = cast<Constant>(Cmp.getOperand(1)); in foldICmpBinOpEqualityWithConstant()
3549 Cmp.getOperand(1), BO); in foldICmpBinOpEqualityWithConstant()
3609 ICmpInst &Cmp, IntrinsicInst *II, const APInt &C) { in foldICmpEqIntrinsicWithConstant() argument
3612 const ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpEqIntrinsicWithConstant()
3716 foldICmpIntrinsicWithIntrinsic(ICmpInst &Cmp, in foldICmpIntrinsicWithIntrinsic() argument
3718 assert(Cmp.isEquality()); in foldICmpIntrinsicWithIntrinsic()
3720 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpIntrinsicWithIntrinsic()
3721 Value *Op0 = Cmp.getOperand(0); in foldICmpIntrinsicWithIntrinsic()
3722 Value *Op1 = Cmp.getOperand(1); in foldICmpIntrinsicWithIntrinsic()
3772 InstCombinerImpl::foldICmpInstWithConstantAllowPoison(ICmpInst &Cmp, in foldICmpInstWithConstantAllowPoison() argument
3774 const ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpInstWithConstantAllowPoison()
3775 if (auto *II = dyn_cast<IntrinsicInst>(Cmp.getOperand(0))) { in foldICmpInstWithConstantAllowPoison()
3781 if (Cmp.isEquality() && II->getArgOperand(0) == II->getArgOperand(1)) { in foldICmpInstWithConstantAllowPoison()
3784 return new ICmpInst(Pred, II->getArgOperand(0), Cmp.getOperand(1)); in foldICmpInstWithConstantAllowPoison()
3794 Instruction *InstCombinerImpl::foldICmpBinOpWithConstant(ICmpInst &Cmp, in foldICmpBinOpWithConstant() argument
3799 if (Instruction *I = foldICmpXorConstant(Cmp, BO, C)) in foldICmpBinOpWithConstant()
3803 if (Instruction *I = foldICmpAndConstant(Cmp, BO, C)) in foldICmpBinOpWithConstant()
3807 if (Instruction *I = foldICmpOrConstant(Cmp, BO, C)) in foldICmpBinOpWithConstant()
3811 if (Instruction *I = foldICmpMulConstant(Cmp, BO, C)) in foldICmpBinOpWithConstant()
3815 if (Instruction *I = foldICmpShlConstant(Cmp, BO, C)) in foldICmpBinOpWithConstant()
3820 if (Instruction *I = foldICmpShrConstant(Cmp, BO, C)) in foldICmpBinOpWithConstant()
3824 if (Instruction *I = foldICmpSRemConstant(Cmp, BO, C)) in foldICmpBinOpWithConstant()
3828 if (Instruction *I = foldICmpUDivConstant(Cmp, BO, C)) in foldICmpBinOpWithConstant()
3832 if (Instruction *I = foldICmpDivConstant(Cmp, BO, C)) in foldICmpBinOpWithConstant()
3836 if (Instruction *I = foldICmpSubConstant(Cmp, BO, C)) in foldICmpBinOpWithConstant()
3840 if (Instruction *I = foldICmpAddConstant(Cmp, BO, C)) in foldICmpBinOpWithConstant()
3848 return foldICmpBinOpEqualityWithConstant(Cmp, BO, C); in foldICmpBinOpWithConstant()
3983 Instruction *InstCombinerImpl::foldICmpIntrinsicWithConstant(ICmpInst &Cmp, in foldICmpIntrinsicWithConstant() argument
3986 ICmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpIntrinsicWithConstant()
3999 const SimplifyQuery Q = SQ.getWithInstruction(&Cmp); in foldICmpIntrinsicWithConstant()
4000 if (Instruction *R = foldCtpopPow2Test(Cmp, II, C, Builder, Q)) in foldICmpIntrinsicWithConstant()
4010 if (Cmp.isEquality()) in foldICmpIntrinsicWithConstant()
4011 return foldICmpEqIntrinsicWithConstant(Cmp, II, C); in foldICmpIntrinsicWithConstant()
6493 auto isMinMaxCmp = [&](Instruction &Cmp) { in foldICmpUsingKnownBits() argument
6494 if (!Cmp.hasOneUse()) in foldICmpUsingKnownBits()
6497 SelectPatternFlavor SPF = matchSelectPattern(Cmp.user_back(), A, B).Flavor; in foldICmpUsingKnownBits()
6979 static Instruction *foldICmpWithHighBitMask(ICmpInst &Cmp, in foldICmpWithHighBitMask() argument
6983 if (match(&Cmp, in foldICmpWithHighBitMask()
6995 } else if (match(&Cmp, m_c_ICmp(Pred, in foldICmpWithHighBitMask()
7022 static Instruction *foldVectorCmp(CmpInst &Cmp, in foldVectorCmp() argument
7024 const CmpInst::Predicate Pred = Cmp.getPredicate(); in foldVectorCmp()
7025 Value *LHS = Cmp.getOperand(0), *RHS = Cmp.getOperand(1); in foldVectorCmp()
7029 Value *V = Builder.CreateCmp(Pred, X, Y, Cmp.getName()); in foldVectorCmp()
7031 I->copyIRFlags(&Cmp); in foldVectorCmp()
7032 Module *M = Cmp.getModule(); in foldVectorCmp()
7554 Value *Cmp = Builder.CreateICmp(Pred, SLTZero, Y, I.getName()); in visitICmpInst() local
7555 return replaceInstUsesWith(I, Cmp); in visitICmpInst()