Lines Matching refs:CmpInst
111 LoadInst *LI, GetElementPtrInst *GEP, GlobalVariable *GV, CmpInst &ICI, in foldCmpLoadFromIndexedGlobal()
740 if (IndicesTheSame && CmpInst::makeCmpResultType(BaseType) == I.getType()) in foldGEPICmp()
818 if ((GEPsInBounds || CmpInst::isEquality(Cond)) && in foldGEPICmp()
966 auto getICmp = [&I](CmpInst::Predicate Pred, Value *LHS, Value *RHS) { in foldICmpShrConstConst()
968 Pred = CmpInst::getInversePredicate(Pred); in foldICmpShrConstConst()
1025 auto getICmp = [&I](CmpInst::Predicate Pred, Value *LHS, Value *RHS) { in foldICmpShlConstConst()
1027 Pred = CmpInst::getInversePredicate(Pred); in foldICmpShlConstConst()
1202 CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpWithZero()
1295 CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpWithConstant()
1342 CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpWithDominatingICmp()
1357 DomPred = CmpInst::getInversePredicate(DomPred); in foldICmpWithDominatingICmp()
1614 CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpXorShiftConst()
1848 auto NewPred = TrueIfNeg ? CmpInst::ICMP_EQ : CmpInst::ICMP_NE; in foldICmpAndConstant()
1857 auto NewPred = TrueIfNeg ? CmpInst::ICMP_EQ : CmpInst::ICMP_NE; 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()
1975 auto BOpc = Pred == CmpInst::ICMP_EQ ? Instruction::And : Instruction::Or; in foldICmpOrXorSubChain()
2007 Pred = (Pred == CmpInst::ICMP_EQ) ? CmpInst::ICMP_ULE : CmpInst::ICMP_UGT; in foldICmpOrConstant()
2068 auto BOpc = Pred == CmpInst::ICMP_EQ ? Instruction::And : Instruction::Or; in foldICmpOrConstant()
2380 CmpInst::Predicate Pred = Cmp.getPredicate(); in foldICmpShrConstant()
2395 return new ICmpInst(TrueIfSigned ? CmpInst::ICMP_EQ : CmpInst::ICMP_NE, in foldICmpShrConstant()
2403 (Pred == CmpInst::ICMP_UGT || Pred == CmpInst::ICMP_ULT)) { in foldICmpShrConstant()
2404 bool IsUGT = Pred == CmpInst::ICMP_UGT; in foldICmpShrConstant()
2411 auto NewPred = IsUGT ? CmpInst::ICMP_ULT : CmpInst::ICMP_UGE; in foldICmpShrConstant()
2434 if (IsExact || Pred == CmpInst::ICMP_SLT || Pred == CmpInst::ICMP_ULT) { in foldICmpShrConstant()
2442 if (Pred == CmpInst::ICMP_SGT) { in foldICmpShrConstant()
2449 if (Pred == CmpInst::ICMP_UGT) { in foldICmpShrConstant()
2464 if (Pred == CmpInst::ICMP_UGT) { in foldICmpShrConstant()
2465 return new ICmpInst(CmpInst::ICMP_SLT, X, in foldICmpShrConstant()
2468 if (Pred == CmpInst::ICMP_ULT) { in foldICmpShrConstant()
2469 return new ICmpInst(CmpInst::ICMP_SGT, X, in foldICmpShrConstant()
2474 if (Pred == CmpInst::ICMP_ULT || (Pred == CmpInst::ICMP_UGT && IsExact)) { in foldICmpShrConstant()
2481 if (Pred == CmpInst::ICMP_UGT) { in foldICmpShrConstant()
2508 if (Pred == CmpInst::ICMP_EQ) in foldICmpShrConstant()
2509 return new ICmpInst(CmpInst::ICMP_ULT, X, in foldICmpShrConstant()
2512 return new ICmpInst(CmpInst::ICMP_UGT, X, in foldICmpShrConstant()
2937 const CmpInst::Predicate Pred = Cmp.getPredicate(); 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()
3812 CmpInst::Predicate EquivPred; in foldICmpUSubSatOrUAddSatWithConstant()
3857 return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, X, in foldICmpIntrinsicWithConstant()
3861 return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE, X, in foldICmpIntrinsicWithConstant()
3870 return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_ULT, in foldICmpIntrinsicWithConstant()
3878 return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_UGT, in foldICmpIntrinsicWithConstant()
3891 return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, in foldICmpIntrinsicWithConstant()
3899 return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE, in foldICmpIntrinsicWithConstant()
4445 CmpInst::Predicate Pred; in foldICmpXNegX()
4469 return CmpInst::Create(Instruction::ICmp, Pred, And, Zero); in foldICmpXNegX()
4479 CmpInst::Predicate Pred = I.getPredicate(); in foldICmpAndXX()
4504 CmpInst::Predicate Pred = I.getPredicate(); in foldICmpOrXX()
4538 CmpInst::Predicate Pred = I.getPredicate(); in foldICmpXorXX()
4550 CmpInst::Predicate PredOut = CmpInst::getStrictPredicate(Pred); in foldICmpXorXX()
4576 const CmpInst::Predicate Pred = I.getPredicate(); in foldICmpBinOp()
4618 CmpInst::Predicate NewPred = in foldICmpBinOp()
4627 CmpInst::Predicate NewPred = in foldICmpBinOp()
4639 auto hasNoWrapProblem = [](const BinaryOperator &BO, CmpInst::Predicate Pred, in foldICmpBinOp()
4645 (CmpInst::isUnsigned(Pred) && HasNUW) || in foldICmpBinOp()
4646 (CmpInst::isSigned(Pred) && HasNSW); in foldICmpBinOp()
4705 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_SLT && in foldICmpBinOp()
4707 return new ICmpInst(CmpInst::ICMP_SLE, A, Op1); in foldICmpBinOp()
4710 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_SGE && in foldICmpBinOp()
4712 return new ICmpInst(CmpInst::ICMP_SGT, A, Op1); in foldICmpBinOp()
4715 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_SLE && match(B, m_One())) in foldICmpBinOp()
4716 return new ICmpInst(CmpInst::ICMP_SLT, A, Op1); in foldICmpBinOp()
4719 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_SGT && match(B, m_One())) in foldICmpBinOp()
4720 return new ICmpInst(CmpInst::ICMP_SGE, A, Op1); in foldICmpBinOp()
4723 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_SGT && in foldICmpBinOp()
4725 return new ICmpInst(CmpInst::ICMP_SGE, Op0, C); in foldICmpBinOp()
4728 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_SLE && in foldICmpBinOp()
4730 return new ICmpInst(CmpInst::ICMP_SLT, Op0, C); in foldICmpBinOp()
4733 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_SGE && match(D, m_One())) in foldICmpBinOp()
4734 return new ICmpInst(CmpInst::ICMP_SGT, Op0, C); in foldICmpBinOp()
4737 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_SLT && match(D, m_One())) in foldICmpBinOp()
4738 return new ICmpInst(CmpInst::ICMP_SLE, Op0, C); in foldICmpBinOp()
4750 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_ULE && match(B, m_One())) in foldICmpBinOp()
4751 return new ICmpInst(CmpInst::ICMP_ULT, A, Op1); in foldICmpBinOp()
4754 if (A && NoOp0WrapProblem && Pred == CmpInst::ICMP_UGT && match(B, m_One())) in foldICmpBinOp()
4755 return new ICmpInst(CmpInst::ICMP_UGE, A, Op1); in foldICmpBinOp()
4758 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_UGE && match(D, m_One())) in foldICmpBinOp()
4759 return new ICmpInst(CmpInst::ICMP_UGT, Op0, C); in foldICmpBinOp()
4762 if (C && NoOp1WrapProblem && Pred == CmpInst::ICMP_ULT && match(D, m_One())) in foldICmpBinOp()
4763 return new ICmpInst(CmpInst::ICMP_ULE, Op0, C); in foldICmpBinOp()
4836 return new ICmpInst(CmpInst::getFlippedStrictnessPredicate(Pred), B, A); in foldICmpBinOp()
4840 return new ICmpInst(CmpInst::getFlippedStrictnessPredicate(Pred), C, D); in foldICmpBinOp()
5191 const CmpInst::Predicate Pred = I.getPredicate(); in foldICmpPow2Test()
5245 const CmpInst::Predicate Pred = I.getPredicate(); 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()
5655 return new ICmpInst(CmpInst::ICMP_SGT, X, Constant::getAllOnesValue(SrcTy)); in foldICmpWithZextOrSext()
5660 return new ICmpInst(CmpInst::ICMP_SLT, X, Constant::getNullValue(SrcTy)); in foldICmpWithZextOrSext()
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()
6451 std::optional<std::pair<CmpInst::Predicate, Constant *>>
6452 InstCombiner::getFlippedStrictnessPredicateAndConstant(CmpInst::Predicate Pred, in getFlippedStrictnessPredicateAndConstant()
6460 CmpInst::Predicate UnsignedPred = ICmpInst::getUnsignedPredicate(Pred); in getFlippedStrictnessPredicateAndConstant()
6515 CmpInst::Predicate NewPred = CmpInst::getFlippedStrictnessPredicate(Pred); in getFlippedStrictnessPredicateAndConstant()
6549 CmpInst *InstCombinerImpl::canonicalizeICmpPredicate(CmpInst &I) { in canonicalizeICmpPredicate()
6551 CmpInst::Predicate Pred = I.getPredicate(); in canonicalizeICmpPredicate()
6561 I.setPredicate(CmpInst::getInversePredicate(Pred)); in canonicalizeICmpPredicate()
6581 case CmpInst::ICMP_EQ: // A == 0 -> !A in canonicalizeICmpBool()
6582 case CmpInst::ICMP_ULE: // A <=u 0 -> !A in canonicalizeICmpBool()
6583 case CmpInst::ICMP_SGE: // A >=s 0 -> !A in canonicalizeICmpBool()
6590 case CmpInst::ICMP_NE: // A != 1 -> !A in canonicalizeICmpBool()
6591 case CmpInst::ICMP_ULT: // A <u 1 -> !A in canonicalizeICmpBool()
6592 case CmpInst::ICMP_SGT: // A >s -1 -> !A in canonicalizeICmpBool()
6690 return CmpInst::Create(Instruction::ICmp, NewPred, NewX, Zero); in foldICmpWithHighBitMask()
6693 static Instruction *foldVectorCmp(CmpInst &Cmp, in foldVectorCmp()
6695 const CmpInst::Predicate Pred = Cmp.getPredicate(); in foldVectorCmp()
6699 auto createCmpReverse = [&](CmpInst::Predicate Pred, Value *X, Value *Y) { in foldVectorCmp()
6764 CmpInst::Predicate Pred = I.getPredicate(); in foldICmpOfUAddOv()
6903 case CmpInst::ICMP_ULE: in foldICmpCommutative()
6904 case CmpInst::ICMP_SGE: in foldICmpCommutative()
6906 case CmpInst::ICMP_UGT: in foldICmpCommutative()
6907 case CmpInst::ICMP_SLT: in foldICmpCommutative()
6909 case CmpInst::ICMP_UGE: in foldICmpCommutative()
6910 case CmpInst::ICMP_SLE: in foldICmpCommutative()
6911 case CmpInst::ICMP_EQ: { in foldICmpCommutative()
6918 case CmpInst::ICMP_ULT: in foldICmpCommutative()
6919 case CmpInst::ICMP_SGT: in foldICmpCommutative()
6920 case CmpInst::ICMP_NE: { in foldICmpCommutative()
6963 return CmpInst::Create(Instruction::ICmp, I.getPredicate(), V, Op1); in visitICmpInst()
6967 return CmpInst::Create(Instruction::ICmp, I.getPredicate(), V, Op1); in visitICmpInst()
7617 CmpInst::Predicate Pred = I.getPredicate(); in foldFCmpFNegCommonOp()
7646 const CmpInst::Predicate Pred = I.getPredicate(); in visitFCmpInst()
7680 if (Pred == CmpInst::FCMP_ORD || Pred == CmpInst::FCMP_UNO) { in visitFCmpInst()