|
reference, declaration → definition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
|
Declarations
include/llvm/Analysis/CmpInstAnalysis.h 20 class ICmpInst;
include/llvm/IR/Instruction.def 206 HANDLE_OTHER_INST(53, ICmp , ICmpInst ) // Integer comparison instruction
References
examples/BrainF/BrainF.cpp 446 ICmpInst *test_0 = new ICmpInst(*testbb, ICmpInst::ICMP_EQ, tape_0,
446 ICmpInst *test_0 = new ICmpInst(*testbb, ICmpInst::ICMP_EQ, tape_0,
446 ICmpInst *test_0 = new ICmpInst(*testbb, ICmpInst::ICMP_EQ, tape_0,
examples/Fibonacci/fibonacci.cpp 76 Value *CondInst = new ICmpInst(*BB, ICmpInst::ICMP_SLE, ArgX, Two, "cond");
76 Value *CondInst = new ICmpInst(*BB, ICmpInst::ICMP_SLE, ArgX, Two, "cond");
examples/ParallelJIT/ParallelJIT.cpp 106 Value *CondInst = new ICmpInst(*BB, ICmpInst::ICMP_SLE, ArgX, Two, "cond");
106 Value *CondInst = new ICmpInst(*BB, ICmpInst::ICMP_SLE, ArgX, Two, "cond");
include/llvm/Analysis/CmpInstAnalysis.h 46 unsigned getICmpCode(const ICmpInst *ICI, bool InvertPred = false);
include/llvm/Analysis/DependenceAnalysis.h 559 bool isKnownPredicate(ICmpInst::Predicate Pred,
include/llvm/Analysis/LoopInfo.h 671 ICmpInst::Predicate getCanonicalPredicate() const;
include/llvm/Analysis/ScalarEvolution.h 676 bool isLoopEntryGuardedByCond(const Loop *L, ICmpInst::Predicate Pred,
681 bool isLoopBackedgeGuardedByCond(const Loop *L, ICmpInst::Predicate Pred,
899 bool isKnownViaInduction(ICmpInst::Predicate Pred, const SCEV *LHS,
904 bool isKnownPredicate(ICmpInst::Predicate Pred, const SCEV *LHS,
909 bool isKnownOnEveryIteration(ICmpInst::Predicate Pred,
921 bool isMonotonicPredicate(const SCEVAddRecExpr *LHS, ICmpInst::Predicate Pred,
928 bool isLoopInvariantPredicate(ICmpInst::Predicate Pred, const SCEV *LHS,
930 ICmpInst::Predicate &InvariantPred,
938 bool SimplifyICmpOperands(ICmpInst::Predicate &Pred, const SCEV *&LHS,
1572 ExitLimit computeExitLimitFromICmp(const Loop *L, ICmpInst *ExitCond,
1589 ICmpInst::Predicate p);
1599 ICmpInst::Predicate Pred);
1649 bool isImpliedCond(ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS,
1655 bool isImpliedCond(ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS,
1656 ICmpInst::Predicate FoundPred, const SCEV *FoundLHS,
1662 bool isImpliedCondOperands(ICmpInst::Predicate Pred, const SCEV *LHS,
1670 bool isImpliedViaOperations(ICmpInst::Predicate Pred,
1677 bool isKnownViaNonRecursiveReasoning(ICmpInst::Predicate Pred,
1683 bool isImpliedCondOperandsHelper(ICmpInst::Predicate Pred, const SCEV *LHS,
1691 bool isImpliedCondOperandsViaRanges(ICmpInst::Predicate Pred, const SCEV *LHS,
1697 bool isImpliedViaGuard(BasicBlock *BB, ICmpInst::Predicate Pred,
1706 bool isImpliedCondOperandsViaNoOverflow(ICmpInst::Predicate Pred,
1718 bool isImpliedViaMerge(ICmpInst::Predicate Pred,
1731 bool isKnownPredicateViaConstantRanges(ICmpInst::Predicate Pred,
1739 bool isKnownPredicateViaNoOverflow(ICmpInst::Predicate Pred, const SCEV *LHS,
1744 bool isKnownPredicateViaSplitting(ICmpInst::Predicate Pred, const SCEV *LHS,
1783 ICmpInst::Predicate Pred, bool &Increasing);
include/llvm/CodeGen/Analysis.h 117 ISD::CondCode getICmpCondCode(ICmpInst::Predicate Pred);
include/llvm/IR/IRBuilder.h 845 InstTy *Insert(InstTy *I, const Twine &Name = "") const {
845 InstTy *Insert(InstTy *I, const Twine &Name = "") const {
2120 return CreateICmp(ICmpInst::ICMP_EQ, LHS, RHS, Name);
2124 return CreateICmp(ICmpInst::ICMP_NE, LHS, RHS, Name);
2128 return CreateICmp(ICmpInst::ICMP_UGT, LHS, RHS, Name);
2132 return CreateICmp(ICmpInst::ICMP_UGE, LHS, RHS, Name);
2136 return CreateICmp(ICmpInst::ICMP_ULT, LHS, RHS, Name);
2140 return CreateICmp(ICmpInst::ICMP_ULE, LHS, RHS, Name);
2144 return CreateICmp(ICmpInst::ICMP_SGT, LHS, RHS, Name);
2148 return CreateICmp(ICmpInst::ICMP_SGE, LHS, RHS, Name);
2152 return CreateICmp(ICmpInst::ICMP_SLT, LHS, RHS, Name);
2156 return CreateICmp(ICmpInst::ICMP_SLE, LHS, RHS, Name);
2234 return Insert(new ICmpInst(P, LHS, RHS), Name);
include/llvm/IR/InstVisitor.h 168 RetTy visitICmpInst(ICmpInst &I) { DELEGATE(CmpInst);}
include/llvm/IR/Instructions.h 1169 ICmpInst *cloneImpl() const;
include/llvm/IR/NoFolder.h 301 return new ICmpInst(P, LHS, RHS);
include/llvm/IR/PatternMatch.h 47 template <typename Val, typename Pattern> bool match(Val *V, const Pattern &P) {
56 template <typename OpTy> bool match(OpTy *V) {
462 ICmpInst::Predicate Pred;
466 case ICmpInst::Predicate::ICMP_EQ:
468 case ICmpInst::Predicate::ICMP_NE:
470 case ICmpInst::Predicate::ICMP_UGT:
472 case ICmpInst::Predicate::ICMP_UGE:
474 case ICmpInst::Predicate::ICMP_ULT:
476 case ICmpInst::Predicate::ICMP_ULE:
478 case ICmpInst::Predicate::ICMP_SGT:
480 case ICmpInst::Predicate::ICMP_SGE:
482 case ICmpInst::Predicate::ICMP_SLT:
484 case ICmpInst::Predicate::ICMP_SLE:
494 m_SpecificInt_ICMP(ICmpInst::Predicate Predicate, const APInt &Threshold) {
1132 template <typename OpTy> bool match(OpTy *V) {
1133 if (auto *I = dyn_cast<Class>(V))
1133 if (auto *I = dyn_cast<Class>(V))
1151 inline CmpClass_match<LHS, RHS, ICmpInst, ICmpInst::Predicate>
1151 inline CmpClass_match<LHS, RHS, ICmpInst, ICmpInst::Predicate>
1152 m_ICmp(ICmpInst::Predicate &Pred, const LHS &L, const RHS &R) {
1153 return CmpClass_match<LHS, RHS, ICmpInst, ICmpInst::Predicate>(Pred, L, R);
1153 return CmpClass_match<LHS, RHS, ICmpInst, ICmpInst::Predicate>(Pred, L, R);
1444 auto *Cmp = dyn_cast<CmpInst_t>(SI->getCondition());
1444 auto *Cmp = dyn_cast<CmpInst_t>(SI->getCondition());
1456 typename CmpInst_t::Predicate Pred =
1469 static bool match(ICmpInst::Predicate Pred) {
1476 static bool match(ICmpInst::Predicate Pred) {
1483 static bool match(ICmpInst::Predicate Pred) {
1490 static bool match(ICmpInst::Predicate Pred) {
1524 inline MaxMin_match<ICmpInst, LHS, RHS, smax_pred_ty> m_SMax(const LHS &L,
1526 return MaxMin_match<ICmpInst, LHS, RHS, smax_pred_ty>(L, R);
1530 inline MaxMin_match<ICmpInst, LHS, RHS, smin_pred_ty> m_SMin(const LHS &L,
1532 return MaxMin_match<ICmpInst, LHS, RHS, smin_pred_ty>(L, R);
1536 inline MaxMin_match<ICmpInst, LHS, RHS, umax_pred_ty> m_UMax(const LHS &L,
1538 return MaxMin_match<ICmpInst, LHS, RHS, umax_pred_ty>(L, R);
1542 inline MaxMin_match<ICmpInst, LHS, RHS, umin_pred_ty> m_UMin(const LHS &L,
1544 return MaxMin_match<ICmpInst, LHS, RHS, umin_pred_ty>(L, R);
1620 template <typename OpTy> bool match(OpTy *V) {
1622 ICmpInst::Predicate Pred;
1630 if (Pred == ICmpInst::ICMP_ULT)
1635 if (Pred == ICmpInst::ICMP_UGT)
1640 if (Pred == ICmpInst::ICMP_EQ) {
1806 inline CmpClass_match<LHS, RHS, ICmpInst, ICmpInst::Predicate, true>
1806 inline CmpClass_match<LHS, RHS, ICmpInst, ICmpInst::Predicate, true>
1807 m_c_ICmp(ICmpInst::Predicate &Pred, const LHS &L, const RHS &R) {
1808 return CmpClass_match<LHS, RHS, ICmpInst, ICmpInst::Predicate, true>(Pred, L,
1808 return CmpClass_match<LHS, RHS, ICmpInst, ICmpInst::Predicate, true>(Pred, L,
1863 inline MaxMin_match<ICmpInst, LHS, RHS, smin_pred_ty, true>
1865 return MaxMin_match<ICmpInst, LHS, RHS, smin_pred_ty, true>(L, R);
1869 inline MaxMin_match<ICmpInst, LHS, RHS, smax_pred_ty, true>
1871 return MaxMin_match<ICmpInst, LHS, RHS, smax_pred_ty, true>(L, R);
1875 inline MaxMin_match<ICmpInst, LHS, RHS, umin_pred_ty, true>
1877 return MaxMin_match<ICmpInst, LHS, RHS, umin_pred_ty, true>(L, R);
1881 inline MaxMin_match<ICmpInst, LHS, RHS, umax_pred_ty, true>
1883 return MaxMin_match<ICmpInst, LHS, RHS, umax_pred_ty, true>(L, R);
include/llvm/Support/Casting.h 58 return To::classof(&Val);
66 static inline bool doit(const From &) { return true; }
77 return isa_impl<To, From>::doit(Val);
92 return isa_impl<To, From>::doit(*Val);
104 static inline bool doit(const From *Val) {
106 return isa_impl<To, From>::doit(*Val);
106 return isa_impl<To, From>::doit(*Val);
122 return isa_impl_wrap<To, SimpleFrom,
132 return isa_impl_cl<To,FromTy>::doit(Val);
142 return isa_impl_wrap<X, const Y,
165 using ret_type = To &; // Normal case, return Ty&
168 using ret_type = const To &; // Normal case, return Ty&
172 using ret_type = To *; // Pointer arg case, return Ty*
176 using ret_type = const To *; // Constant pointer arg case, return const Ty*
198 using ret_type = typename cast_retty<To, SimpleFrom>::ret_type;
204 using ret_type = typename cast_retty_impl<To,FromTy>::ret_type;
210 To, From, typename simplify_type<From>::SimpleType>::ret_type;
218 static typename cast_retty<To, From>::ret_type doit(From &Val) {
219 return cast_convert_val<To, SimpleFrom,
227 static typename cast_retty<To, FromTy>::ret_type doit(const FromTy &Val) {
228 typename cast_retty<To, FromTy>::ret_type Res2
248 typename cast_retty<X, const Y>::ret_type>::type
256 inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
258 return cast_convert_val<X, Y,
263 inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
263 inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
263 inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
265 return cast_convert_val<X, Y*,
265 return cast_convert_val<X, Y*,
266 typename simplify_type<Y*>::SimpleType>::doit(Val);
331 typename cast_retty<X, const Y>::ret_type>::type
337 LLVM_NODISCARD inline typename cast_retty<X, Y>::ret_type dyn_cast(Y &Val) {
338 return isa<X>(Val) ? cast<X>(Val) : nullptr;
338 return isa<X>(Val) ? cast<X>(Val) : nullptr;
342 LLVM_NODISCARD inline typename cast_retty<X, Y *>::ret_type dyn_cast(Y *Val) {
342 LLVM_NODISCARD inline typename cast_retty<X, Y *>::ret_type dyn_cast(Y *Val) {
342 LLVM_NODISCARD inline typename cast_retty<X, Y *>::ret_type dyn_cast(Y *Val) {
343 return isa<X>(Val) ? cast<X>(Val) : nullptr;
343 return isa<X>(Val) ? cast<X>(Val) : nullptr;
366 LLVM_NODISCARD inline typename cast_retty<X, Y *>::ret_type
368 return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr;
368 return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr;
lib/Analysis/AssumptionCache.cpp 86 if (Pred == ICmpInst::ICMP_EQ) {
lib/Analysis/BranchProbabilityInfo.cpp 406 ICmpInst *CI = dyn_cast<ICmpInst>(Cond);
406 ICmpInst *CI = dyn_cast<ICmpInst>(Cond);
422 bool isProb = CI->getPredicate() == ICmpInst::ICMP_NE;
666 ICmpInst *CI = dyn_cast<ICmpInst>(Cond);
666 ICmpInst *CI = dyn_cast<ICmpInst>(Cond);
lib/Analysis/CmpInstAnalysis.cpp 21 unsigned llvm::getICmpCode(const ICmpInst *ICI, bool InvertPred) {
22 ICmpInst::Predicate Pred = InvertPred ? ICI->getInversePredicate()
26 case ICmpInst::ICMP_UGT: return 1; // 001
27 case ICmpInst::ICMP_SGT: return 1; // 001
28 case ICmpInst::ICMP_EQ: return 2; // 010
29 case ICmpInst::ICMP_UGE: return 3; // 011
30 case ICmpInst::ICMP_SGE: return 3; // 011
31 case ICmpInst::ICMP_ULT: return 4; // 100
32 case ICmpInst::ICMP_SLT: return 4; // 100
33 case ICmpInst::ICMP_NE: return 5; // 101
34 case ICmpInst::ICMP_ULE: return 6; // 110
35 case ICmpInst::ICMP_SLE: return 6; // 110
48 case 1: Pred = Sign ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; break;
48 case 1: Pred = Sign ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; break;
49 case 2: Pred = ICmpInst::ICMP_EQ; break;
50 case 3: Pred = Sign ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE; break;
50 case 3: Pred = Sign ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE; break;
51 case 4: Pred = Sign ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT; break;
51 case 4: Pred = Sign ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT; break;
52 case 5: Pred = ICmpInst::ICMP_NE; break;
53 case 6: Pred = Sign ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE; break;
53 case 6: Pred = Sign ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE; break;
60 bool llvm::predicatesFoldable(ICmpInst::Predicate P1, ICmpInst::Predicate P2) {
60 bool llvm::predicatesFoldable(ICmpInst::Predicate P1, ICmpInst::Predicate P2) {
62 (CmpInst::isSigned(P1) && ICmpInst::isEquality(P2)) ||
63 (CmpInst::isSigned(P2) && ICmpInst::isEquality(P1));
78 case ICmpInst::ICMP_SLT:
83 Pred = ICmpInst::ICMP_NE;
85 case ICmpInst::ICMP_SLE:
90 Pred = ICmpInst::ICMP_NE;
92 case ICmpInst::ICMP_SGT:
97 Pred = ICmpInst::ICMP_EQ;
99 case ICmpInst::ICMP_SGE:
104 Pred = ICmpInst::ICMP_EQ;
106 case ICmpInst::ICMP_ULT:
111 Pred = ICmpInst::ICMP_EQ;
113 case ICmpInst::ICMP_ULE:
118 Pred = ICmpInst::ICMP_EQ;
120 case ICmpInst::ICMP_UGT:
125 Pred = ICmpInst::ICMP_NE;
127 case ICmpInst::ICMP_UGE:
132 Pred = ICmpInst::ICMP_NE;
lib/Analysis/ConstantFolding.cpp 1269 if ((Predicate == ICmpInst::ICMP_EQ || Predicate == ICmpInst::ICMP_NE) &&
1269 if ((Predicate == ICmpInst::ICMP_EQ || Predicate == ICmpInst::ICMP_NE) &&
1276 Predicate == ICmpInst::ICMP_EQ ? Instruction::And : Instruction::Or;
1282 Predicate = ICmpInst::getSwappedPredicate((ICmpInst::Predicate)Predicate);
lib/Analysis/DependenceAnalysis.cpp 967 bool DependenceInfo::isKnownPredicate(ICmpInst::Predicate Pred, const SCEV *X,
lib/Analysis/GlobalsModRef.cpp 381 } else if (ICmpInst *ICI = dyn_cast<ICmpInst>(I)) {
381 } else if (ICmpInst *ICI = dyn_cast<ICmpInst>(I)) {
lib/Analysis/IVDescriptors.cpp 292 !isa<ICmpInst>(Cur) && !isa<FCmpInst>(Cur) &&
326 (isa<ICmpInst>(Cur) || isa<SelectInst>(Cur)))
377 ((!isa<FCmpInst>(UI) && !isa<ICmpInst>(UI) &&
470 if ((Cmp = dyn_cast<ICmpInst>(I)) || (Cmp = dyn_cast<FCmpInst>(I))) {
479 if (!(Cmp = dyn_cast<ICmpInst>(I->getOperand(0))) &&
lib/Analysis/InstructionSimplify.cpp 82 ExpectedPred = ICmpInst::ICMP_NE;
84 ExpectedPred = ICmpInst::ICMP_EQ;
948 static bool isICmpTrue(ICmpInst::Predicate Pred, Value *LHS, Value *RHS,
1004 return isICmpTrue(ICmpInst::ICMP_ULT, X, Y, Q, MaxRecurse);
1373 static Value *simplifyUnsignedRangeCheck(ICmpInst *ZeroICmp,
1374 ICmpInst *UnsignedICmp, bool IsAnd,
1378 ICmpInst::Predicate EqPred;
1380 !ICmpInst::isEquality(EqPred))
1383 ICmpInst::Predicate UnsignedPred;
1390 ICmpInst::isUnsigned(UnsignedPred)) {
1392 UnsignedPred = ICmpInst::getSwappedPredicate(UnsignedPred);
1395 if ((UnsignedPred == ICmpInst::ICMP_UGE ||
1396 UnsignedPred == ICmpInst::ICMP_ULE) &&
1397 EqPred == ICmpInst::ICMP_NE && !IsAnd)
1400 if ((UnsignedPred == ICmpInst::ICMP_ULT ||
1401 UnsignedPred == ICmpInst::ICMP_UGT) &&
1402 EqPred == ICmpInst::ICMP_EQ && IsAnd)
1407 if (EqPred == ICmpInst::ICMP_NE && (UnsignedPred == ICmpInst::ICMP_ULT ||
1407 if (EqPred == ICmpInst::ICMP_NE && (UnsignedPred == ICmpInst::ICMP_ULT ||
1408 UnsignedPred == ICmpInst::ICMP_UGT))
1413 if (EqPred == ICmpInst::ICMP_EQ && (UnsignedPred == ICmpInst::ICMP_ULE ||
1413 if (EqPred == ICmpInst::ICMP_EQ && (UnsignedPred == ICmpInst::ICMP_ULE ||
1414 UnsignedPred == ICmpInst::ICMP_UGE))
1424 UnsignedPred = ICmpInst::getSwappedPredicate(UnsignedPred);
1426 if (UnsignedPred == ICmpInst::ICMP_UGE && IsAnd &&
1427 EqPred == ICmpInst::ICMP_NE &&
1430 if (UnsignedPred == ICmpInst::ICMP_ULT && !IsAnd &&
1431 EqPred == ICmpInst::ICMP_EQ &&
1438 ICmpInst::isUnsigned(UnsignedPred))
1442 ICmpInst::isUnsigned(UnsignedPred))
1443 UnsignedPred = ICmpInst::getSwappedPredicate(UnsignedPred);
1449 if (UnsignedPred == ICmpInst::ICMP_ULT && EqPred == ICmpInst::ICMP_NE)
1449 if (UnsignedPred == ICmpInst::ICMP_ULT && EqPred == ICmpInst::ICMP_NE)
1454 if (UnsignedPred == ICmpInst::ICMP_ULE && EqPred == ICmpInst::ICMP_NE &&
1454 if (UnsignedPred == ICmpInst::ICMP_ULE && EqPred == ICmpInst::ICMP_NE &&
1460 if (UnsignedPred == ICmpInst::ICMP_UGE && EqPred == ICmpInst::ICMP_EQ)
1460 if (UnsignedPred == ICmpInst::ICMP_UGE && EqPred == ICmpInst::ICMP_EQ)
1465 if (UnsignedPred == ICmpInst::ICMP_UGT && EqPred == ICmpInst::ICMP_EQ &&
1465 if (UnsignedPred == ICmpInst::ICMP_UGT && EqPred == ICmpInst::ICMP_EQ &&
1470 if (UnsignedPred == ICmpInst::ICMP_ULT && EqPred == ICmpInst::ICMP_EQ &&
1470 if (UnsignedPred == ICmpInst::ICMP_ULT && EqPred == ICmpInst::ICMP_EQ &&
1475 if (UnsignedPred == ICmpInst::ICMP_UGE && EqPred == ICmpInst::ICMP_NE &&
1475 if (UnsignedPred == ICmpInst::ICMP_UGE && EqPred == ICmpInst::ICMP_NE &&
1484 static Value *simplifyAndOfICmpsWithSameOperands(ICmpInst *Op0, ICmpInst *Op1) {
1484 static Value *simplifyAndOfICmpsWithSameOperands(ICmpInst *Op0, ICmpInst *Op1) {
1485 ICmpInst::Predicate Pred0, Pred1;
1494 if (ICmpInst::isImpliedTrueByMatchingCmp(Pred0, Pred1))
1498 if ((Pred0 == ICmpInst::getInversePredicate(Pred1)) ||
1499 (Pred0 == ICmpInst::ICMP_EQ && ICmpInst::isFalseWhenEqual(Pred1)) ||
1499 (Pred0 == ICmpInst::ICMP_EQ && ICmpInst::isFalseWhenEqual(Pred1)) ||
1500 (Pred0 == ICmpInst::ICMP_SLT && Pred1 == ICmpInst::ICMP_SGT) ||
1500 (Pred0 == ICmpInst::ICMP_SLT && Pred1 == ICmpInst::ICMP_SGT) ||
1501 (Pred0 == ICmpInst::ICMP_ULT && Pred1 == ICmpInst::ICMP_UGT))
1501 (Pred0 == ICmpInst::ICMP_ULT && Pred1 == ICmpInst::ICMP_UGT))
1509 static Value *simplifyOrOfICmpsWithSameOperands(ICmpInst *Op0, ICmpInst *Op1) {
1509 static Value *simplifyOrOfICmpsWithSameOperands(ICmpInst *Op0, ICmpInst *Op1) {
1510 ICmpInst::Predicate Pred0, Pred1;
1519 if (ICmpInst::isImpliedTrueByMatchingCmp(Pred0, Pred1))
1524 if ((Pred0 == ICmpInst::getInversePredicate(Pred1)) ||
1525 (Pred0 == ICmpInst::ICMP_NE && ICmpInst::isTrueWhenEqual(Pred1)) ||
1525 (Pred0 == ICmpInst::ICMP_NE && ICmpInst::isTrueWhenEqual(Pred1)) ||
1526 (Pred0 == ICmpInst::ICMP_SLE && Pred1 == ICmpInst::ICMP_SGE) ||
1526 (Pred0 == ICmpInst::ICMP_SLE && Pred1 == ICmpInst::ICMP_SGE) ||
1527 (Pred0 == ICmpInst::ICMP_ULE && Pred1 == ICmpInst::ICMP_UGE))
1527 (Pred0 == ICmpInst::ICMP_ULE && Pred1 == ICmpInst::ICMP_UGE))
1536 static Value *simplifyAndOrOfICmpsWithConstants(ICmpInst *Cmp0, ICmpInst *Cmp1,
1536 static Value *simplifyAndOrOfICmpsWithConstants(ICmpInst *Cmp0, ICmpInst *Cmp1,
1573 static Value *simplifyAndOrOfICmpsWithZero(ICmpInst *Cmp0, ICmpInst *Cmp1,
1573 static Value *simplifyAndOrOfICmpsWithZero(ICmpInst *Cmp0, ICmpInst *Cmp1,
1575 ICmpInst::Predicate P0 = Cmp0->getPredicate(), P1 = Cmp1->getPredicate();
1580 if ((IsAnd && P0 != ICmpInst::ICMP_NE) || (!IsAnd && P1 != ICmpInst::ICMP_EQ))
1580 if ((IsAnd && P0 != ICmpInst::ICMP_NE) || (!IsAnd && P1 != ICmpInst::ICMP_EQ))
1610 static Value *simplifyAndOfICmpsWithAdd(ICmpInst *Op0, ICmpInst *Op1,
1610 static Value *simplifyAndOfICmpsWithAdd(ICmpInst *Op0, ICmpInst *Op1,
1613 ICmpInst::Predicate Pred0, Pred1;
1633 if (Pred0 == ICmpInst::ICMP_ULT && Pred1 == ICmpInst::ICMP_SGT)
1633 if (Pred0 == ICmpInst::ICMP_ULT && Pred1 == ICmpInst::ICMP_SGT)
1635 if (Pred0 == ICmpInst::ICMP_SLT && Pred1 == ICmpInst::ICMP_SGT && isNSW)
1635 if (Pred0 == ICmpInst::ICMP_SLT && Pred1 == ICmpInst::ICMP_SGT && isNSW)
1639 if (Pred0 == ICmpInst::ICMP_ULE && Pred1 == ICmpInst::ICMP_SGT)
1639 if (Pred0 == ICmpInst::ICMP_ULE && Pred1 == ICmpInst::ICMP_SGT)
1641 if (Pred0 == ICmpInst::ICMP_SLE && Pred1 == ICmpInst::ICMP_SGT && isNSW)
1641 if (Pred0 == ICmpInst::ICMP_SLE && Pred1 == ICmpInst::ICMP_SGT && isNSW)
1647 if (Pred0 == ICmpInst::ICMP_ULT && Pred1 == ICmpInst::ICMP_UGT)
1647 if (Pred0 == ICmpInst::ICMP_ULT && Pred1 == ICmpInst::ICMP_UGT)
1650 if (Pred0 == ICmpInst::ICMP_ULE && Pred1 == ICmpInst::ICMP_UGT)
1650 if (Pred0 == ICmpInst::ICMP_ULE && Pred1 == ICmpInst::ICMP_UGT)
1657 static Value *simplifyAndOfICmps(ICmpInst *Op0, ICmpInst *Op1,
1657 static Value *simplifyAndOfICmps(ICmpInst *Op0, ICmpInst *Op1,
1683 static Value *simplifyOrOfICmpsWithAdd(ICmpInst *Op0, ICmpInst *Op1,
1683 static Value *simplifyOrOfICmpsWithAdd(ICmpInst *Op0, ICmpInst *Op1,
1686 ICmpInst::Predicate Pred0, Pred1;
1706 if (Pred0 == ICmpInst::ICMP_UGE && Pred1 == ICmpInst::ICMP_SLE)
1706 if (Pred0 == ICmpInst::ICMP_UGE && Pred1 == ICmpInst::ICMP_SLE)
1708 if (Pred0 == ICmpInst::ICMP_SGE && Pred1 == ICmpInst::ICMP_SLE && isNSW)
1708 if (Pred0 == ICmpInst::ICMP_SGE && Pred1 == ICmpInst::ICMP_SLE && isNSW)
1712 if (Pred0 == ICmpInst::ICMP_UGT && Pred1 == ICmpInst::ICMP_SLE)
1712 if (Pred0 == ICmpInst::ICMP_UGT && Pred1 == ICmpInst::ICMP_SLE)
1714 if (Pred0 == ICmpInst::ICMP_SGT && Pred1 == ICmpInst::ICMP_SLE && isNSW)
1714 if (Pred0 == ICmpInst::ICMP_SGT && Pred1 == ICmpInst::ICMP_SLE && isNSW)
1720 if (Pred0 == ICmpInst::ICMP_UGE && Pred1 == ICmpInst::ICMP_ULE)
1720 if (Pred0 == ICmpInst::ICMP_UGE && Pred1 == ICmpInst::ICMP_ULE)
1723 if (Pred0 == ICmpInst::ICMP_UGT && Pred1 == ICmpInst::ICMP_ULE)
1723 if (Pred0 == ICmpInst::ICMP_UGT && Pred1 == ICmpInst::ICMP_ULE)
1730 static Value *simplifyOrOfICmps(ICmpInst *Op0, ICmpInst *Op1,
1730 static Value *simplifyOrOfICmps(ICmpInst *Op0, ICmpInst *Op1,
1806 auto *ICmp0 = dyn_cast<ICmpInst>(Op0);
1806 auto *ICmp0 = dyn_cast<ICmpInst>(Op0);
1807 auto *ICmp1 = dyn_cast<ICmpInst>(Op1);
1807 auto *ICmp1 = dyn_cast<ICmpInst>(Op1);
1861 ICmpInst::Predicate Pred;
1864 Pred != ICmpInst::Predicate::ICMP_NE)
1885 ICmpInst::Predicate Pred;
1888 Pred != ICmpInst::Predicate::ICMP_EQ)
2334 Pred = ICmpInst::getSignedPredicate(Pred);
2536 case ICmpInst::ICMP_UGE:
2540 case ICmpInst::ICMP_SGE:
2551 case ICmpInst::ICMP_ULE:
2570 case ICmpInst::ICMP_ULT:
2572 case ICmpInst::ICMP_UGE:
2574 case ICmpInst::ICMP_EQ:
2575 case ICmpInst::ICMP_ULE:
2579 case ICmpInst::ICMP_NE:
2580 case ICmpInst::ICMP_UGT:
2584 case ICmpInst::ICMP_SLT: {
2592 case ICmpInst::ICMP_SLE: {
2601 case ICmpInst::ICMP_SGE: {
2609 case ICmpInst::ICMP_SGT: {
2633 if (Pred == ICmpInst::ICMP_SLT && match(RHS, m_Zero()))
2635 if (Pred == ICmpInst::ICMP_SGT && match(RHS, m_AllOnes()))
2680 ICmpInst::isEquality(Pred) ||
2690 ICmpInst::isEquality(Pred) ||
2743 if (Pred == ICmpInst::ICMP_ULT)
2745 if (Pred == ICmpInst::ICMP_UGE)
2748 if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SGE) {
2748 if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SGE) {
2752 return Pred == ICmpInst::ICMP_SLT ? getTrue(ITy) : getFalse(ITy);
2754 return Pred == ICmpInst::ICMP_SLT ? getFalse(ITy) : getTrue(ITy);
2759 if (Pred == ICmpInst::ICMP_ULE)
2761 if (Pred == ICmpInst::ICMP_UGT)
2764 if (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SLE) {
2764 if (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SLE) {
2768 return Pred == ICmpInst::ICMP_SGT ? getTrue(ITy) : getFalse(ITy);
2770 return Pred == ICmpInst::ICMP_SGT ? getFalse(ITy) : getTrue(ITy);
2777 if (Pred == ICmpInst::ICMP_UGT)
2779 if (Pred == ICmpInst::ICMP_ULE)
2784 if (Pred == ICmpInst::ICMP_UGE)
2786 if (Pred == ICmpInst::ICMP_ULT)
2794 if (Pred == ICmpInst::ICMP_SLT)
2796 if (Pred == ICmpInst::ICMP_SGE)
2798 if (Pred == ICmpInst::ICMP_EQ)
2800 if (Pred == ICmpInst::ICMP_NE)
2804 if (Pred == ICmpInst::ICMP_SLE)
2806 if (Pred == ICmpInst::ICMP_SGT)
2817 case ICmpInst::ICMP_SGT:
2818 case ICmpInst::ICMP_SGE: {
2824 case ICmpInst::ICMP_EQ:
2825 case ICmpInst::ICMP_UGT:
2826 case ICmpInst::ICMP_UGE:
2828 case ICmpInst::ICMP_SLT:
2829 case ICmpInst::ICMP_SLE: {
2835 case ICmpInst::ICMP_NE:
2836 case ICmpInst::ICMP_ULT:
2837 case ICmpInst::ICMP_ULE:
2847 case ICmpInst::ICMP_SGT:
2848 case ICmpInst::ICMP_SGE: {
2854 case ICmpInst::ICMP_NE:
2855 case ICmpInst::ICMP_UGT:
2856 case ICmpInst::ICMP_UGE:
2858 case ICmpInst::ICMP_SLT:
2859 case ICmpInst::ICMP_SLE: {
2865 case ICmpInst::ICMP_EQ:
2866 case ICmpInst::ICMP_ULT:
2867 case ICmpInst::ICMP_ULE:
2877 if (Pred == ICmpInst::ICMP_UGT)
2879 if (Pred == ICmpInst::ICMP_ULE)
2888 if (Pred == ICmpInst::ICMP_ULT)
2890 if (Pred == ICmpInst::ICMP_UGE)
2915 if (Pred == ICmpInst::ICMP_EQ)
2917 if (Pred == ICmpInst::ICMP_NE)
2922 if (Pred == ICmpInst::ICMP_UGT)
2924 if (Pred == ICmpInst::ICMP_ULE)
2937 if (ICmpInst::isSigned(Pred) || !Q.IIQ.isExact(LBO) ||
2945 if (!ICmpInst::isEquality(Pred) || !Q.IIQ.isExact(LBO) ||
2964 if (!NSW && ICmpInst::isSigned(Pred))
3202 if (isa<UndefValue>(RHS) && ICmpInst::isEquality(Pred))
3275 if (Value *V = SimplifyICmpInst(ICmpInst::getUnsignedPredicate(Pred),
3291 if (Value *V = SimplifyICmpInst(ICmpInst::getUnsignedPredicate(Pred),
3301 case ICmpInst::ICMP_EQ:
3302 case ICmpInst::ICMP_UGT:
3303 case ICmpInst::ICMP_UGE:
3306 case ICmpInst::ICMP_NE:
3307 case ICmpInst::ICMP_ULT:
3308 case ICmpInst::ICMP_ULE:
3313 case ICmpInst::ICMP_SGT:
3314 case ICmpInst::ICMP_SGE:
3319 case ICmpInst::ICMP_SLT:
3320 case ICmpInst::ICMP_SLE:
3358 case ICmpInst::ICMP_EQ:
3360 case ICmpInst::ICMP_NE:
3365 case ICmpInst::ICMP_SGT:
3366 case ICmpInst::ICMP_SGE:
3370 case ICmpInst::ICMP_SLT:
3371 case ICmpInst::ICMP_SLE:
3378 case ICmpInst::ICMP_UGT:
3379 case ICmpInst::ICMP_UGE:
3382 if (Value *V = SimplifyICmpInst(ICmpInst::ICMP_SLT, SrcOp,
3387 case ICmpInst::ICMP_ULT:
3388 case ICmpInst::ICMP_ULE:
3391 if (Value *V = SimplifyICmpInst(ICmpInst::ICMP_SGE, SrcOp,
3403 if (ICmpInst::isEquality(Pred) &&
3405 return Pred == ICmpInst::ICMP_NE ? getTrue(ITy) : getFalse(ITy);
3435 (ICmpInst::isEquality(Pred) ||
3437 Pred == ICmpInst::getSignedPredicate(Pred)))) {
3800 ICmpInst::Predicate Pred,
3808 Pred == ICmpInst::ICMP_EQ);
3816 ICmpInst::Predicate Pred;
3821 if (ICmpInst::isEquality(Pred) && match(CmpRHS, m_Zero())) {
3826 Pred == ICmpInst::ICMP_EQ))
3838 Pred == ICmpInst::ICMP_EQ)
3843 Pred == ICmpInst::ICMP_NE)
3860 Pred == ICmpInst::ICMP_NE)
3865 Pred == ICmpInst::ICMP_EQ)
3877 if (Pred == ICmpInst::ICMP_EQ) {
3888 } else if (Pred == ICmpInst::ICMP_NE) {
5321 Result = SimplifyICmpInst(cast<ICmpInst>(I)->getPredicate(),
lib/Analysis/LazyValueInfo.cpp 955 if (auto *ICI = dyn_cast<ICmpInst>(Cond)) {
955 if (auto *ICI = dyn_cast<ICmpInst>(Cond)) {
956 ICmpInst::Predicate Pred = ICI->getPredicate();
969 case ICmpInst::ICMP_EQ:
977 case ICmpInst::ICMP_NE:
1190 static ValueLatticeElement getValueFromICmpCondition(Value *Val, ICmpInst *ICI,
1200 if (isTrueDest == (Predicate == ICmpInst::ICMP_EQ))
1282 if (ICmpInst *ICI = dyn_cast<ICmpInst>(Cond))
1282 if (ICmpInst *ICI = dyn_cast<ICmpInst>(Cond))
1788 if (Pred == ICmpInst::ICMP_EQ) {
1794 } else if (Pred == ICmpInst::ICMP_NE) {
1815 if (Pred == ICmpInst::ICMP_EQ) {
1817 Res = ConstantFoldCompareInstOperands(ICmpInst::ICMP_NE,
1822 } else if (Pred == ICmpInst::ICMP_NE) {
1824 Res = ConstantFoldCompareInstOperands(ICmpInst::ICMP_NE,
1859 if (Pred == ICmpInst::ICMP_EQ)
1861 else if (Pred == ICmpInst::ICMP_NE)
lib/Analysis/LoopCacheAnalysis.cpp 395 return SE.isKnownPredicate(ICmpInst::ICMP_ULT, Stride, CacheLineSize);
lib/Analysis/LoopInfo.cpp 170 static ICmpInst *getLatchCmpInst(const Loop &L) {
174 return dyn_cast<ICmpInst>(BI->getCondition());
182 ICmpInst *LatchCmpInst = getLatchCmpInst(L);
228 ICmpInst::Predicate Loop::LoopBounds::getCanonicalPredicate() const {
235 ICmpInst *LatchCmpInst = dyn_cast<ICmpInst>(BI->getCondition());
235 ICmpInst *LatchCmpInst = dyn_cast<ICmpInst>(BI->getCondition());
241 ICmpInst::Predicate Pred = (BI->getSuccessor(0) == L.getHeader())
246 Pred = ICmpInst::getSwappedPredicate(Pred);
255 if (Pred != ICmpInst::ICMP_NE && Pred != ICmpInst::ICMP_EQ)
255 if (Pred != ICmpInst::ICMP_NE && Pred != ICmpInst::ICMP_EQ)
256 return ICmpInst::getFlippedStrictnessPredicate(Pred);
260 return ICmpInst::ICMP_SLT;
263 return ICmpInst::ICMP_SGT;
267 return ICmpInst::BAD_ICMP_PREDICATE;
296 ICmpInst *CmpInst = getLatchCmpInst(*this);
lib/Analysis/ScalarEvolution.cpp 1346 ICmpInst::Predicate *Pred,
1350 *Pred = ICmpInst::ICMP_SLT;
1355 *Pred = ICmpInst::ICMP_SGT;
1366 ICmpInst::Predicate *Pred,
1369 *Pred = ICmpInst::ICMP_ULT;
1402 ICmpInst::Predicate *Pred,
1418 ICmpInst::Predicate *Pred,
1498 ICmpInst::Predicate Pred;
1589 ICmpInst::Predicate Pred = ICmpInst::BAD_ICMP_PREDICATE;
1589 ICmpInst::Predicate Pred = ICmpInst::BAD_ICMP_PREDICATE;
1792 if (isLoopBackedgeGuardedByCond(L, ICmpInst::ICMP_ULT, AR, N) ||
1793 isKnownOnEveryIteration(ICmpInst::ICMP_ULT, AR, N)) {
1807 if (isLoopBackedgeGuardedByCond(L, ICmpInst::ICMP_UGT, AR, N) ||
1808 isKnownOnEveryIteration(ICmpInst::ICMP_UGT, AR, N)) {
2141 ICmpInst::Predicate Pred;
3637 IsSigned ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE;
3637 IsSigned ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE;
3639 IsSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE;
3639 IsSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE;
4851 isKnownPredicate(ICmpInst::ICMP_NE, Expr, ExtendedExpr);
4871 !isKnownPredicate(ICmpInst::ICMP_EQ, Expr, ExtendedExpr)) {
5336 auto *ICI = dyn_cast<ICmpInst>(Cond);
5336 auto *ICI = dyn_cast<ICmpInst>(Cond);
5344 case ICmpInst::ICMP_SLT:
5345 case ICmpInst::ICMP_SLE:
5348 case ICmpInst::ICMP_SGT:
5349 case ICmpInst::ICMP_SGE:
5367 case ICmpInst::ICMP_ULT:
5368 case ICmpInst::ICMP_ULE:
5371 case ICmpInst::ICMP_UGT:
5372 case ICmpInst::ICMP_UGE:
5390 case ICmpInst::ICMP_NE:
5404 case ICmpInst::ICMP_EQ:
7327 if (ICmpInst *ExitCondICmp = dyn_cast<ICmpInst>(ExitCond)) {
7327 if (ICmpInst *ExitCondICmp = dyn_cast<ICmpInst>(ExitCond)) {
7357 ICmpInst *ExitCond,
7362 ICmpInst::Predicate Pred;
7367 const ICmpInst::Predicate OriginalPred = Pred;
7390 Pred = ICmpInst::getSwappedPredicate(Pred);
7410 case ICmpInst::ICMP_NE: { // while (X != Y)
7417 case ICmpInst::ICMP_EQ: { // while (X == Y)
7423 case ICmpInst::ICMP_SLT:
7424 case ICmpInst::ICMP_ULT: { // while (X < Y)
7425 bool IsSigned = Pred == ICmpInst::ICMP_SLT;
7431 case ICmpInst::ICMP_SGT:
7432 case ICmpInst::ICMP_UGT: { // while (X > Y)
7433 bool IsSigned = Pred == ICmpInst::ICMP_SGT;
7495 ICmpInst::Predicate predicate) {
7567 Value *LHS, Value *RHSV, const Loop *L, ICmpInst::Predicate Pred) {
8796 if (isLoopEntryGuardedByCond(L, ICmpInst::ICMP_NE, DistancePlusOne, Zero)) {
8894 bool ScalarEvolution::SimplifyICmpOperands(ICmpInst::Predicate &Pred,
8902 Pred = TriviallyTrue ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE;
8902 Pred = TriviallyTrue ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE;
8922 Pred = ICmpInst::getSwappedPredicate(Pred);
8933 Pred = ICmpInst::getSwappedPredicate(Pred);
8945 if (!ICmpInst::isEquality(Pred)) {
8955 ICmpInst::isEquality(NewPred)) {
8967 case ICmpInst::ICMP_EQ:
8968 case ICmpInst::ICMP_NE:
8988 case ICmpInst::ICMP_UGE:
8990 Pred = ICmpInst::ICMP_UGT;
8994 case ICmpInst::ICMP_ULE:
8996 Pred = ICmpInst::ICMP_ULT;
9000 case ICmpInst::ICMP_SGE:
9002 Pred = ICmpInst::ICMP_SGT;
9006 case ICmpInst::ICMP_SLE:
9008 Pred = ICmpInst::ICMP_SLT;
9018 if (ICmpInst::isTrueWhenEqual(Pred))
9020 if (ICmpInst::isFalseWhenEqual(Pred))
9027 case ICmpInst::ICMP_SLE:
9031 Pred = ICmpInst::ICMP_SLT;
9036 Pred = ICmpInst::ICMP_SLT;
9040 case ICmpInst::ICMP_SGE:
9044 Pred = ICmpInst::ICMP_SGT;
9049 Pred = ICmpInst::ICMP_SGT;
9053 case ICmpInst::ICMP_ULE:
9057 Pred = ICmpInst::ICMP_ULT;
9061 Pred = ICmpInst::ICMP_ULT;
9065 case ICmpInst::ICMP_UGE:
9068 Pred = ICmpInst::ICMP_UGT;
9073 Pred = ICmpInst::ICMP_UGT;
9123 bool ScalarEvolution::isKnownViaInduction(ICmpInst::Predicate Pred,
9172 bool ScalarEvolution::isKnownPredicate(ICmpInst::Predicate Pred,
9187 bool ScalarEvolution::isKnownOnEveryIteration(ICmpInst::Predicate Pred,
9196 ICmpInst::Predicate Pred,
9205 LHS, ICmpInst::getSwappedPredicate(Pred), IncreasingSwapped);
9217 ICmpInst::Predicate Pred,
9234 case ICmpInst::ICMP_UGT:
9235 case ICmpInst::ICMP_UGE:
9236 case ICmpInst::ICMP_ULT:
9237 case ICmpInst::ICMP_ULE:
9241 Increasing = Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_UGE;
9241 Increasing = Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_UGE;
9244 case ICmpInst::ICMP_SGT:
9245 case ICmpInst::ICMP_SGE:
9246 case ICmpInst::ICMP_SLT:
9247 case ICmpInst::ICMP_SLE: {
9254 Increasing = Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SGE;
9254 Increasing = Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SGE;
9259 Increasing = Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SLE;
9259 Increasing = Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SLE;
9272 ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS, const Loop *L,
9273 ICmpInst::Predicate &InvariantPred, const SCEV *&InvariantLHS,
9282 Pred = ICmpInst::getSwappedPredicate(Pred);
9311 auto P = Increasing ? Pred : ICmpInst::getInversePredicate(Pred);
9323 ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS) {
9325 return ICmpInst::isTrueWhenEqual(Pred);
9352 bool ScalarEvolution::isKnownPredicateViaNoOverflow(ICmpInst::Predicate Pred,
9377 case ICmpInst::ICMP_SGE:
9380 case ICmpInst::ICMP_SLE:
9391 case ICmpInst::ICMP_SGT:
9394 case ICmpInst::ICMP_SLT:
9409 bool ScalarEvolution::isKnownPredicateViaSplitting(ICmpInst::Predicate Pred,
9412 if (Pred != ICmpInst::ICMP_ULT || ProvingSplitPredicate)
9432 ICmpInst::Predicate Pred,
9453 ICmpInst::Predicate Pred,
9497 if (isImpliedCond(Pred, LHS, RHS, ICmpInst::ICMP_ULT, LoopCounter,
9563 ICmpInst::Predicate Pred,
9587 auto NonStrictPredicate = ICmpInst::getNonStrictPredicate(Pred);
9596 isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_NE, LHS, RHS);
9611 isImpliedViaGuard(Block, ICmpInst::ICMP_NE, LHS, RHS);
9628 isImpliedCond(ICmpInst::ICMP_NE, LHS, RHS, Condition, Inverse);
9672 bool ScalarEvolution::isImpliedCond(ICmpInst::Predicate Pred,
9695 ICmpInst *ICI = dyn_cast<ICmpInst>(FoundCondValue);
9695 ICmpInst *ICI = dyn_cast<ICmpInst>(FoundCondValue);
9700 ICmpInst::Predicate FoundPred;
9712 bool ScalarEvolution::isImpliedCond(ICmpInst::Predicate Pred, const SCEV *LHS,
9714 ICmpInst::Predicate FoundPred,
9751 FoundPred = ICmpInst::getSwappedPredicate(FoundPred);
9754 Pred = ICmpInst::getSwappedPredicate(Pred);
9764 if (ICmpInst::getSwappedPredicate(FoundPred) == Pred) {
9768 return isImpliedCondOperands(ICmpInst::getSwappedPredicate(Pred),
9780 if (FoundPred == ICmpInst::ICMP_NE &&
9799 APInt Min = ICmpInst::isSigned(Pred) ?
9810 case ICmpInst::ICMP_SGE:
9811 case ICmpInst::ICMP_UGE:
9819 case ICmpInst::ICMP_SGT:
9820 case ICmpInst::ICMP_UGT:
9842 if (FoundPred == ICmpInst::ICMP_EQ)
9843 if (ICmpInst::isTrueWhenEqual(Pred))
9846 if (Pred == ICmpInst::ICMP_NE)
9847 if (!ICmpInst::isTrueWhenEqual(FoundPred))
9928 ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS,
10004 bool ScalarEvolution::isImpliedViaMerge(ICmpInst::Predicate Pred,
10054 Pred = ICmpInst::getSwappedPredicate(Pred);
10114 bool ScalarEvolution::isImpliedCondOperands(ICmpInst::Predicate Pred,
10144 ICmpInst::Predicate Pred,
10150 if (!ICmpInst::isRelational(Pred))
10167 SCEV::NoWrapFlags NW = ICmpInst::isSigned(Pred) ?
10178 ICmpInst::Predicate Pred,
10184 case ICmpInst::ICMP_SGE:
10187 case ICmpInst::ICMP_SLE:
10194 case ICmpInst::ICMP_UGE:
10197 case ICmpInst::ICMP_ULE:
10208 bool ScalarEvolution::isImpliedViaOperations(ICmpInst::Predicate Pred,
10224 if (Pred == ICmpInst::ICMP_SLT) {
10225 Pred = ICmpInst::ICMP_SGT;
10229 if (Pred != ICmpInst::ICMP_SGT)
10248 return isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_SGT, S1, S2) ||
10249 isImpliedViaOperations(ICmpInst::ICMP_SGT, S1, S2, OrigFoundLHS,
10358 static bool isKnownPredicateExtendIdiom(ICmpInst::Predicate Pred,
10362 case ICmpInst::ICMP_SGE:
10365 case ICmpInst::ICMP_SLE: {
10373 case ICmpInst::ICMP_UGE:
10376 case ICmpInst::ICMP_ULE: {
10391 ScalarEvolution::isKnownViaNonRecursiveReasoning(ICmpInst::Predicate Pred,
10401 ScalarEvolution::isImpliedCondOperandsHelper(ICmpInst::Predicate Pred,
10407 case ICmpInst::ICMP_EQ:
10408 case ICmpInst::ICMP_NE:
10412 case ICmpInst::ICMP_SLT:
10413 case ICmpInst::ICMP_SLE:
10414 if (isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_SLE, LHS, FoundLHS) &&
10415 isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_SGE, RHS, FoundRHS))
10418 case ICmpInst::ICMP_SGT:
10419 case ICmpInst::ICMP_SGE:
10420 if (isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_SGE, LHS, FoundLHS) &&
10421 isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_SLE, RHS, FoundRHS))
10424 case ICmpInst::ICMP_ULT:
10425 case ICmpInst::ICMP_ULE:
10426 if (isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_ULE, LHS, FoundLHS) &&
10427 isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_UGE, RHS, FoundRHS))
10430 case ICmpInst::ICMP_UGT:
10431 case ICmpInst::ICMP_UGE:
10432 if (isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_UGE, LHS, FoundLHS) &&
10433 isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_ULE, RHS, FoundRHS))
10445 bool ScalarEvolution::isImpliedCondOperandsViaRanges(ICmpInst::Predicate Pred,
10664 ICmpInst::Predicate Cond = IsSigned ? ICmpInst::ICMP_SLT
10664 ICmpInst::Predicate Cond = IsSigned ? ICmpInst::ICMP_SLT
10665 : ICmpInst::ICMP_ULT;
10758 ICmpInst::Predicate Cond = IsSigned ? ICmpInst::ICMP_SGT
10758 ICmpInst::Predicate Cond = IsSigned ? ICmpInst::ICMP_SGT
10759 : ICmpInst::ICMP_UGT;
lib/Analysis/ScalarEvolutionExpander.cpp 2103 ICmpInst::Predicate Pred;
2278 Value *StepCompare = Builder.CreateICmp(ICmpInst::ICMP_SLT, StepValue, Zero);
2308 Signed ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT, Sub, StartValue);
2308 Signed ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT, Sub, StartValue);
2311 Signed ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT, Add, StartValue);
2311 Signed ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT, Add, StartValue);
2323 Builder.CreateICmp(ICmpInst::ICMP_UGT, TripCountVal,
2326 BackedgeCheck, Builder.CreateICmp(ICmpInst::ICMP_NE, StepValue, Zero));
lib/Analysis/ValueTracking.cpp 215 if (const ICmpInst *IC = dyn_cast<ICmpInst>(U))
215 if (const ICmpInst *IC = dyn_cast<ICmpInst>(U))
624 ICmpInst *Cmp = dyn_cast<ICmpInst>(Arg);
624 ICmpInst *Cmp = dyn_cast<ICmpInst>(Arg);
636 case ICmpInst::ICMP_EQ:
774 case ICmpInst::ICMP_SGE:
787 case ICmpInst::ICMP_SGT:
800 case ICmpInst::ICMP_SLE:
813 case ICmpInst::ICMP_SLT:
826 case ICmpInst::ICMP_ULE:
837 case ICmpInst::ICMP_ULT:
1931 (Pred != ICmpInst::ICMP_EQ && Pred != ICmpInst::ICMP_NE))
1931 (Pred != ICmpInst::ICMP_EQ && Pred != ICmpInst::ICMP_NE))
1948 if (Pred == ICmpInst::ICMP_NE)
1961 BI->getSuccessor(Pred == ICmpInst::ICMP_EQ ? 1 : 0);
1965 } else if (Pred == ICmpInst::ICMP_NE && isGuard(Curr) &&
4542 Pred = ICmpInst::getSwappedPredicate(Pred);
4595 if (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SGE) {
4595 if (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SGE) {
4596 Pred = ICmpInst::getSwappedPredicate(Pred);
4599 if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SLE)
4599 if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SLE)
4603 if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SLE) {
4603 if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SLE) {
4604 Pred = ICmpInst::getSwappedPredicate(Pred);
4607 if (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SGE)
4607 if (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SGE)
4611 if (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_UGE) {
4611 if (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_UGE) {
4612 Pred = ICmpInst::getSwappedPredicate(Pred);
4615 if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_ULE)
4615 if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_ULE)
4619 if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_ULE) {
4619 if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_ULE) {
4620 Pred = ICmpInst::getSwappedPredicate(Pred);
4623 if (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_UGE)
4623 if (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_UGE)
4862 case ICmpInst::ICMP_UGT:
4863 case ICmpInst::ICMP_UGE: return {SPF_UMAX, SPNB_NA, false};
4864 case ICmpInst::ICMP_SGT:
4865 case ICmpInst::ICMP_SGE: return {SPF_SMAX, SPNB_NA, false};
4866 case ICmpInst::ICMP_ULT:
4867 case ICmpInst::ICMP_ULE: return {SPF_UMIN, SPNB_NA, false};
4868 case ICmpInst::ICMP_SLT:
4869 case ICmpInst::ICMP_SLE: return {SPF_SMIN, SPNB_NA, false};
4898 if (Pred == ICmpInst::ICMP_SGT && match(CmpRHS, ZeroOrAllOnes))
4902 if (Pred == ICmpInst::ICMP_SGE && match(CmpRHS, ZeroOrOne))
4907 if (Pred == ICmpInst::ICMP_SLT && match(CmpRHS, ZeroOrOne))
4920 if (Pred == ICmpInst::ICMP_SGT && match(CmpRHS, ZeroOrAllOnes))
4925 if (Pred == ICmpInst::ICMP_SLT && match(CmpRHS, ZeroOrOne))
5110 if (SPF == SPF_SMIN) return ICmpInst::ICMP_SLT;
5111 if (SPF == SPF_UMIN) return ICmpInst::ICMP_ULT;
5112 if (SPF == SPF_SMAX) return ICmpInst::ICMP_SGT;
5113 if (SPF == SPF_UMAX) return ICmpInst::ICMP_UGT;
5138 if (ICmpInst::isTrueWhenEqual(Pred) && LHS == RHS)
5237 BPred = ICmpInst::getSwappedPredicate(BPred);
5270 static Optional<bool> isImpliedCondICmps(const ICmpInst *LHS,
5271 const ICmpInst *RHS,
5278 ICmpInst::Predicate APred =
5283 ICmpInst::Predicate BPred = RHS->getPredicate();
5316 const ICmpInst *RHS,
5370 const ICmpInst *LHSCmp = dyn_cast<ICmpInst>(LHS);
5370 const ICmpInst *LHSCmp = dyn_cast<ICmpInst>(LHS);
5371 const ICmpInst *RHSCmp = dyn_cast<ICmpInst>(RHS);
5371 const ICmpInst *RHSCmp = dyn_cast<ICmpInst>(RHS);
lib/Analysis/VectorUtils.cpp 393 if ((isa<TruncInst>(&I) || isa<ICmpInst>(&I)) &&
lib/AsmParser/LLParser.cpp 6531 Inst = new ICmpInst(CmpInst::Predicate(Pred), LHS, RHS);
lib/Bitcode/Reader/BitcodeReader.cpp 4203 I = new ICmpInst((ICmpInst::Predicate)PredVal, LHS, RHS);
lib/CodeGen/Analysis.cpp 238 ISD::CondCode llvm::getICmpCondCode(ICmpInst::Predicate Pred) {
240 case ICmpInst::ICMP_EQ: return ISD::SETEQ;
241 case ICmpInst::ICMP_NE: return ISD::SETNE;
242 case ICmpInst::ICMP_SLE: return ISD::SETLE;
243 case ICmpInst::ICMP_ULE: return ISD::SETULE;
244 case ICmpInst::ICMP_SGE: return ISD::SETGE;
245 case ICmpInst::ICMP_UGE: return ISD::SETUGE;
246 case ICmpInst::ICMP_SLT: return ISD::SETLT;
247 case ICmpInst::ICMP_ULT: return ISD::SETULT;
248 case ICmpInst::ICMP_SGT: return ISD::SETGT;
249 case ICmpInst::ICMP_UGT: return ISD::SETUGT;
lib/CodeGen/CodeGenPrepare.cpp 1237 ICmpInst::Predicate Pred = Cmp->getPredicate();
1238 if (Pred == ICmpInst::ICMP_EQ && match(B, m_AllOnes()))
1240 else if (Pred == ICmpInst::ICMP_NE && match(B, m_ZeroInt()))
1292 ICmpInst::Predicate Pred = Cmp->getPredicate();
1293 if (Pred == ICmpInst::ICMP_UGT) {
1295 Pred = ICmpInst::ICMP_ULT;
1298 if (Pred == ICmpInst::ICMP_EQ && match(B, m_ZeroInt())) {
1300 Pred = ICmpInst::ICMP_ULT;
1303 if (Pred == ICmpInst::ICMP_NE && match(B, m_ZeroInt())) {
1305 Pred = ICmpInst::ICMP_ULT;
1307 if (Pred != ICmpInst::ICMP_ULT)
1454 if (!isa<ICmpInst>(User))
lib/CodeGen/ExpandMemCmp.cpp 299 Value *Cmp = Builder.CreateICmp(ICmpInst::ICMP_NE, Diff,
478 Value *Cmp = Builder.CreateICmp(ICmpInst::ICMP_EQ, LoadSrc1, LoadSrc2);
514 Value *Cmp = Builder.CreateICmp(ICmpInst::ICMP_ULT, ResBlock.PhiSrc1,
lib/CodeGen/GlobalISel/LegalizerHelper.cpp 979 ICmpInst::getUnsignedPredicate(Pred), ResTy, LHSL, RHSL);
3177 auto IsShort = MIRBuilder.buildICmp(ICmpInst::ICMP_ULT, CondTy, Amt, NewBits);
3178 auto IsZero = MIRBuilder.buildICmp(ICmpInst::ICMP_EQ, CondTy, Amt, Zero);
lib/CodeGen/HardwareLoops.cpp 291 if (BI->isUnconditional() || !isa<ICmpInst>(BI->getCondition()))
296 auto ICmp = cast<ICmpInst>(BI->getCondition());
310 unsigned SuccIdx = ICmp->getPredicate() == ICmpInst::ICMP_NE ? 0 : 1;
333 if (SE.isLoopEntryGuardedByCond(L, ICmpInst::ICMP_NE, ExitCount,
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp 2042 if (const ICmpInst *IC = dyn_cast<ICmpInst>(Cond)) {
2042 if (const ICmpInst *IC = dyn_cast<ICmpInst>(Cond)) {
2043 ICmpInst::Predicate Pred =
3197 ICmpInst::Predicate predicate = ICmpInst::BAD_ICMP_PREDICATE;
3197 ICmpInst::Predicate predicate = ICmpInst::BAD_ICMP_PREDICATE;
3198 if (const ICmpInst *IC = dyn_cast<ICmpInst>(&I))
3198 if (const ICmpInst *IC = dyn_cast<ICmpInst>(&I))
lib/ExecutionEngine/Interpreter/Execution.cpp 331 void Interpreter::visitICmpInst(ICmpInst &I) {
339 case ICmpInst::ICMP_EQ: R = executeICMP_EQ(Src1, Src2, Ty); break;
340 case ICmpInst::ICMP_NE: R = executeICMP_NE(Src1, Src2, Ty); break;
341 case ICmpInst::ICMP_ULT: R = executeICMP_ULT(Src1, Src2, Ty); break;
342 case ICmpInst::ICMP_SLT: R = executeICMP_SLT(Src1, Src2, Ty); break;
343 case ICmpInst::ICMP_UGT: R = executeICMP_UGT(Src1, Src2, Ty); break;
344 case ICmpInst::ICMP_SGT: R = executeICMP_SGT(Src1, Src2, Ty); break;
345 case ICmpInst::ICMP_ULE: R = executeICMP_ULE(Src1, Src2, Ty); break;
346 case ICmpInst::ICMP_SLE: R = executeICMP_SLE(Src1, Src2, Ty); break;
347 case ICmpInst::ICMP_UGE: R = executeICMP_UGE(Src1, Src2, Ty); break;
348 case ICmpInst::ICMP_SGE: R = executeICMP_SGE(Src1, Src2, Ty); break;
702 case ICmpInst::ICMP_EQ: return executeICMP_EQ(Src1, Src2, Ty);
703 case ICmpInst::ICMP_NE: return executeICMP_NE(Src1, Src2, Ty);
704 case ICmpInst::ICMP_UGT: return executeICMP_UGT(Src1, Src2, Ty);
705 case ICmpInst::ICMP_SGT: return executeICMP_SGT(Src1, Src2, Ty);
706 case ICmpInst::ICMP_ULT: return executeICMP_ULT(Src1, Src2, Ty);
707 case ICmpInst::ICMP_SLT: return executeICMP_SLT(Src1, Src2, Ty);
708 case ICmpInst::ICMP_UGE: return executeICMP_UGE(Src1, Src2, Ty);
709 case ICmpInst::ICMP_SGE: return executeICMP_SGE(Src1, Src2, Ty);
710 case ICmpInst::ICMP_ULE: return executeICMP_ULE(Src1, Src2, Ty);
711 case ICmpInst::ICMP_SLE: return executeICMP_SLE(Src1, Src2, Ty);
lib/ExecutionEngine/Interpreter/Interpreter.h 129 void visitICmpInst(ICmpInst &I);
lib/IR/AutoUpgrade.cpp 1148 Pred = IsSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
1148 Pred = IsSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
1151 Pred = IsSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE;
1151 Pred = IsSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE;
1154 Pred = IsSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
1154 Pred = IsSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
1157 Pred = IsSigned ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE;
1157 Pred = IsSigned ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE;
1160 Pred = ICmpInst::ICMP_EQ;
1163 Pred = ICmpInst::ICMP_NE;
1256 Value *Cmp = Builder.CreateICmp(ICmpInst::ICMP_SGT, Op0, Zero);
1267 ICmpInst::Predicate Pred) {
1342 ICmpInst::Predicate Pred;
1345 case 0: Pred = ICmpInst::ICMP_EQ; break;
1346 case 1: Pred = Signed ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT; break;
1346 case 1: Pred = Signed ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT; break;
1347 case 2: Pred = Signed ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE; break;
1347 case 2: Pred = Signed ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE; break;
1348 case 4: Pred = ICmpInst::ICMP_NE; break;
1349 case 5: Pred = Signed ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE; break;
1349 case 5: Pred = Signed ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE; break;
1350 case 6: Pred = Signed ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; break;
1350 case 6: Pred = Signed ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; break;
1779 Rep = Builder.CreateICmp(CmpEq ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_SGT,
1779 Rep = Builder.CreateICmp(CmpEq ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_SGT,
1831 ICmpInst::Predicate Pred =
1832 Name.startswith("avx512.ptestm") ? ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ;
1832 Name.startswith("avx512.ptestm") ? ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ;
2009 Rep = Builder.CreateICmp(ICmpInst::ICMP_SLT, Op, Zero);
2022 Rep = upgradeIntMinMax(Builder, *CI, ICmpInst::ICMP_SGT);
2028 Rep = upgradeIntMinMax(Builder, *CI, ICmpInst::ICMP_UGT);
2034 Rep = upgradeIntMinMax(Builder, *CI, ICmpInst::ICMP_SLT);
2040 Rep = upgradeIntMinMax(Builder, *CI, ICmpInst::ICMP_ULT);
lib/IR/ConstantFold.cpp 1499 static ICmpInst::Predicate areGlobalsPotentiallyEqual(const GlobalValue *GV1,
1519 return ICmpInst::ICMP_NE;
1520 return ICmpInst::BAD_ICMP_PREDICATE;
1535 static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2,
1539 if (V1 == V2) return ICmpInst::ICMP_EQ;
1548 ICmpInst::Predicate pred = ICmpInst::ICMP_EQ;
1548 ICmpInst::Predicate pred = ICmpInst::ICMP_EQ;
1552 pred = isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
1552 pred = isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
1556 pred = isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
1556 pred = isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
1562 return ICmpInst::BAD_ICMP_PREDICATE;
1566 ICmpInst::Predicate SwappedRelation =
1568 if (SwappedRelation != ICmpInst::BAD_ICMP_PREDICATE)
1569 return ICmpInst::getSwappedPredicate(SwappedRelation);
1573 ICmpInst::Predicate SwappedRelation =
1575 if (SwappedRelation != ICmpInst::BAD_ICMP_PREDICATE)
1576 return ICmpInst::getSwappedPredicate(SwappedRelation);
1577 return ICmpInst::BAD_ICMP_PREDICATE;
1586 return ICmpInst::ICMP_NE; // Globals never equal labels.
1597 return ICmpInst::ICMP_NE;
1601 ICmpInst::Predicate SwappedRelation =
1603 if (SwappedRelation != ICmpInst::BAD_ICMP_PREDICATE)
1604 return ICmpInst::getSwappedPredicate(SwappedRelation);
1605 return ICmpInst::BAD_ICMP_PREDICATE;
1616 return ICmpInst::ICMP_NE;
1621 return ICmpInst::ICMP_NE;
1668 return isSigned ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE;
1668 return isSigned ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE;
1672 return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
1672 return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
1679 return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
1679 return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
1681 return ICmpInst::ICMP_EQ;
1689 return isSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE;
1689 return isSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE;
1693 return isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
1693 return isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
1703 return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
1703 return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
1707 return ICmpInst::BAD_ICMP_PREDICATE;
1728 return ICmpInst::BAD_ICMP_PREDICATE;
1741 return ICmpInst::BAD_ICMP_PREDICATE; // Might be equal.
1749 case -1: return isSigned ? ICmpInst::ICMP_SLT:ICmpInst::ICMP_ULT;
1749 case -1: return isSigned ? ICmpInst::ICMP_SLT:ICmpInst::ICMP_ULT;
1750 case 1: return isSigned ? ICmpInst::ICMP_SGT:ICmpInst::ICMP_UGT;
1750 case 1: return isSigned ? ICmpInst::ICMP_SGT:ICmpInst::ICMP_UGT;
1751 case -2: return ICmpInst::BAD_ICMP_PREDICATE;
1759 return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
1759 return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
1761 return ICmpInst::BAD_ICMP_PREDICATE; // Might be equal.
1767 return isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
1767 return isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
1769 return ICmpInst::BAD_ICMP_PREDICATE; // Might be equal.
1771 return ICmpInst::ICMP_EQ;
1782 return ICmpInst::BAD_ICMP_PREDICATE;
1804 bool isIntegerPredicate = ICmpInst::isIntPredicate(Predicate);
1808 if (ICmpInst::isEquality(Predicate) || (isIntegerPredicate && C1 == C2))
1828 if (pred == ICmpInst::ICMP_EQ)
1830 else if (pred == ICmpInst::ICMP_NE)
1840 if (pred == ICmpInst::ICMP_EQ)
1842 else if (pred == ICmpInst::ICMP_NE)
1850 case ICmpInst::ICMP_EQ:
1854 case ICmpInst::ICMP_NE:
1866 case ICmpInst::ICMP_EQ: return ConstantInt::get(ResultTy, V1 == V2);
1867 case ICmpInst::ICMP_NE: return ConstantInt::get(ResultTy, V1 != V2);
1868 case ICmpInst::ICMP_SLT: return ConstantInt::get(ResultTy, V1.slt(V2));
1869 case ICmpInst::ICMP_SGT: return ConstantInt::get(ResultTy, V1.sgt(V2));
1870 case ICmpInst::ICMP_SLE: return ConstantInt::get(ResultTy, V1.sle(V2));
1871 case ICmpInst::ICMP_SGE: return ConstantInt::get(ResultTy, V1.sge(V2));
1872 case ICmpInst::ICMP_ULT: return ConstantInt::get(ResultTy, V1.ult(V2));
1873 case ICmpInst::ICMP_UGT: return ConstantInt::get(ResultTy, V1.ugt(V2));
1874 case ICmpInst::ICMP_ULE: return ConstantInt::get(ResultTy, V1.ule(V2));
1875 case ICmpInst::ICMP_UGE: return ConstantInt::get(ResultTy, V1.uge(V2));
2011 case ICmpInst::BAD_ICMP_PREDICATE:
2013 case ICmpInst::ICMP_EQ: // We know the constants are equal!
2016 Result = ICmpInst::isTrueWhenEqual((ICmpInst::Predicate)pred);
2018 case ICmpInst::ICMP_ULT:
2020 case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_NE: case ICmpInst::ICMP_ULE:
2020 case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_NE: case ICmpInst::ICMP_ULE:
2020 case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_NE: case ICmpInst::ICMP_ULE:
2022 case ICmpInst::ICMP_UGT: case ICmpInst::ICMP_EQ: case ICmpInst::ICMP_UGE:
2022 case ICmpInst::ICMP_UGT: case ICmpInst::ICMP_EQ: case ICmpInst::ICMP_UGE:
2022 case ICmpInst::ICMP_UGT: case ICmpInst::ICMP_EQ: case ICmpInst::ICMP_UGE:
2026 case ICmpInst::ICMP_SLT:
2028 case ICmpInst::ICMP_SLT: case ICmpInst::ICMP_NE: case ICmpInst::ICMP_SLE:
2028 case ICmpInst::ICMP_SLT: case ICmpInst::ICMP_NE: case ICmpInst::ICMP_SLE:
2028 case ICmpInst::ICMP_SLT: case ICmpInst::ICMP_NE: case ICmpInst::ICMP_SLE:
2030 case ICmpInst::ICMP_SGT: case ICmpInst::ICMP_EQ: case ICmpInst::ICMP_SGE:
2030 case ICmpInst::ICMP_SGT: case ICmpInst::ICMP_EQ: case ICmpInst::ICMP_SGE:
2030 case ICmpInst::ICMP_SGT: case ICmpInst::ICMP_EQ: case ICmpInst::ICMP_SGE:
2034 case ICmpInst::ICMP_UGT:
2036 case ICmpInst::ICMP_UGT: case ICmpInst::ICMP_NE: case ICmpInst::ICMP_UGE:
2036 case ICmpInst::ICMP_UGT: case ICmpInst::ICMP_NE: case ICmpInst::ICMP_UGE:
2036 case ICmpInst::ICMP_UGT: case ICmpInst::ICMP_NE: case ICmpInst::ICMP_UGE:
2038 case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_EQ: case ICmpInst::ICMP_ULE:
2038 case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_EQ: case ICmpInst::ICMP_ULE:
2038 case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_EQ: case ICmpInst::ICMP_ULE:
2042 case ICmpInst::ICMP_SGT:
2044 case ICmpInst::ICMP_SGT: case ICmpInst::ICMP_NE: case ICmpInst::ICMP_SGE:
2044 case ICmpInst::ICMP_SGT: case ICmpInst::ICMP_NE: case ICmpInst::ICMP_SGE:
2044 case ICmpInst::ICMP_SGT: case ICmpInst::ICMP_NE: case ICmpInst::ICMP_SGE:
2046 case ICmpInst::ICMP_SLT: case ICmpInst::ICMP_EQ: case ICmpInst::ICMP_SLE:
2046 case ICmpInst::ICMP_SLT: case ICmpInst::ICMP_EQ: case ICmpInst::ICMP_SLE:
2046 case ICmpInst::ICMP_SLT: case ICmpInst::ICMP_EQ: case ICmpInst::ICMP_SLE:
2050 case ICmpInst::ICMP_ULE:
2051 if (pred == ICmpInst::ICMP_UGT) Result = 0;
2052 if (pred == ICmpInst::ICMP_ULT || pred == ICmpInst::ICMP_ULE) Result = 1;
2052 if (pred == ICmpInst::ICMP_ULT || pred == ICmpInst::ICMP_ULE) Result = 1;
2054 case ICmpInst::ICMP_SLE:
2055 if (pred == ICmpInst::ICMP_SGT) Result = 0;
2056 if (pred == ICmpInst::ICMP_SLT || pred == ICmpInst::ICMP_SLE) Result = 1;
2056 if (pred == ICmpInst::ICMP_SLT || pred == ICmpInst::ICMP_SLE) Result = 1;
2058 case ICmpInst::ICMP_UGE:
2059 if (pred == ICmpInst::ICMP_ULT) Result = 0;
2060 if (pred == ICmpInst::ICMP_UGT || pred == ICmpInst::ICMP_UGE) Result = 1;
2060 if (pred == ICmpInst::ICMP_UGT || pred == ICmpInst::ICMP_UGE) Result = 1;
2062 case ICmpInst::ICMP_SGE:
2063 if (pred == ICmpInst::ICMP_SLT) Result = 0;
2064 if (pred == ICmpInst::ICMP_SGT || pred == ICmpInst::ICMP_SGE) Result = 1;
2064 if (pred == ICmpInst::ICMP_SGT || pred == ICmpInst::ICMP_SGE) Result = 1;
2066 case ICmpInst::ICMP_NE:
2067 if (pred == ICmpInst::ICMP_EQ) Result = 0;
2068 if (pred == ICmpInst::ICMP_NE) Result = 1;
2093 ICmpInst::isSigned((ICmpInst::Predicate)pred)) ||
2095 !ICmpInst::isSigned((ICmpInst::Predicate)pred))){
2113 pred = ICmpInst::getSwappedPredicate((ICmpInst::Predicate)pred);
lib/IR/Constants.cpp 262 return PatternMatch::match(ConstantExpr::getICmp(ICmpInst::Predicate::ICMP_EQ,
lib/IR/Core.cpp 2736 if (ICmpInst *I = dyn_cast<ICmpInst>(unwrap(Inst)))
2736 if (ICmpInst *I = dyn_cast<ICmpInst>(unwrap(Inst)))
lib/IR/Instructions.cpp 3493 return new ICmpInst(InsertBefore, CmpInst::Predicate(predicate),
3496 return new ICmpInst(CmpInst::Predicate(predicate),
3512 return new ICmpInst(*InsertAtEnd, CmpInst::Predicate(predicate),
3520 if (ICmpInst *IC = dyn_cast<ICmpInst>(this))
3520 if (ICmpInst *IC = dyn_cast<ICmpInst>(this))
3527 if (const ICmpInst *IC = dyn_cast<ICmpInst>(this))
3527 if (const ICmpInst *IC = dyn_cast<ICmpInst>(this))
3533 if (const ICmpInst *IC = dyn_cast<ICmpInst>(this))
3533 if (const ICmpInst *IC = dyn_cast<ICmpInst>(this))
3590 case ICmpInst::ICMP_EQ: return "eq";
3591 case ICmpInst::ICMP_NE: return "ne";
3592 case ICmpInst::ICMP_SGT: return "sgt";
3593 case ICmpInst::ICMP_SGE: return "sge";
3594 case ICmpInst::ICMP_SLT: return "slt";
3595 case ICmpInst::ICMP_SLE: return "sle";
3596 case ICmpInst::ICMP_UGT: return "ugt";
3597 case ICmpInst::ICMP_UGE: return "uge";
3598 case ICmpInst::ICMP_ULT: return "ult";
3599 case ICmpInst::ICMP_ULE: return "ule";
3603 ICmpInst::Predicate ICmpInst::getSignedPredicate(Predicate pred) {
3616 ICmpInst::Predicate ICmpInst::getUnsignedPredicate(Predicate pred) {
3716 case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_ULE: case ICmpInst::ICMP_UGT:
3716 case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_ULE: case ICmpInst::ICMP_UGT:
3716 case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_ULE: case ICmpInst::ICMP_UGT:
3717 case ICmpInst::ICMP_UGE: return true;
3724 case ICmpInst::ICMP_SLT: case ICmpInst::ICMP_SLE: case ICmpInst::ICMP_SGT:
3724 case ICmpInst::ICMP_SLT: case ICmpInst::ICMP_SLE: case ICmpInst::ICMP_SGT:
3724 case ICmpInst::ICMP_SLT: case ICmpInst::ICMP_SLE: case ICmpInst::ICMP_SGT:
3725 case ICmpInst::ICMP_SGE: return true;
4117 ICmpInst *ICmpInst::cloneImpl() const {
4118 return new ICmpInst(getPredicate(), Op<0>(), Op<1>());
lib/IR/Verifier.cpp 454 void visitICmpInst(ICmpInst &IC);
3220 void Verifier::visitICmpInst(ICmpInst &IC) {
lib/Target/AArch64/AArch64InstructionSelector.cpp 2659 unsigned NotOpc = Pred == ICmpInst::ICMP_NE ? AArch64::NOTv8i8 : 0;
lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp 117 bool promoteUniformOpToI32(ICmpInst &I) const;
182 bool visitICmpInst(ICmpInst &I);
224 return isa<ICmpInst>(I.getOperand(0)) ?
225 cast<ICmpInst>(I.getOperand(0))->isSigned() : false;
330 bool AMDGPUCodeGenPrepare::promoteUniformOpToI32(ICmpInst &I) const {
978 bool AMDGPUCodeGenPrepare::visitICmpInst(ICmpInst &I) {
lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp 2046 B.buildICmp(ICmpInst::ICMP_EQ, MI.getOperand(0), Hi32, ApertureReg);
lib/Target/AMDGPU/AMDGPULowerKernelAttributes.cpp 194 ICmpInst::Predicate Pred;
199 Pred == ICmpInst::ICMP_ULT) {
lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp 361 ICmpInst *cmp =
362 dyn_cast<ICmpInst>(Builder.CreateICmpNE(pcall, zeroIntPtr, ""));
lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp 566 if (ICmpInst *ICmp = dyn_cast<ICmpInst>(UseInst)) {
566 if (ICmpInst *ICmp = dyn_cast<ICmpInst>(UseInst)) {
832 if (ICmpInst *CI = dyn_cast<ICmpInst>(V)) {
832 if (ICmpInst *CI = dyn_cast<ICmpInst>(V)) {
lib/Target/AMDGPU/SIISelLowering.cpp 4186 if (CondCode < ICmpInst::Predicate::FIRST_ICMP_PREDICATE ||
4187 CondCode > ICmpInst::Predicate::LAST_ICMP_PREDICATE)
4190 ICmpInst::Predicate IcInput = static_cast<ICmpInst::Predicate>(CondCode);
4199 unsigned PromoteOp = ICmpInst::isSigned(IcInput) ?
5995 Op.getConstantOperandVal(3) == ICmpInst::Predicate::ICMP_NE)
lib/Target/ARM/ARMCodeGenPrepare.cpp 274 if (auto *ICmp = dyn_cast<ICmpInst>(V))
274 if (auto *ICmp = dyn_cast<ICmpInst>(V))
346 !isa<ICmpInst>(*I->user_begin()) ||
358 auto *CI = cast<ICmpInst>(*I->user_begin());
358 auto *CI = cast<ICmpInst>(*I->user_begin());
404 if (isa<ICmpInst>(I))
1028 if (isa<ICmpInst>(I)) {
1029 auto &CI = cast<ICmpInst>(I);
1029 auto &CI = cast<ICmpInst>(I);
lib/Target/ARM/MVETailPredication.cpp 211 Pred != ICmpInst::ICMP_ULE || !L->isLoopInvariant(Shuffle))
lib/Target/SystemZ/SystemZISelLowering.cpp 852 if (isa<ICmpInst>(SingleUser)) {
lib/Target/WebAssembly/WebAssemblyFastISel.cpp 420 if (const auto *ICmp = dyn_cast<ICmpInst>(V))
420 if (const auto *ICmp = dyn_cast<ICmpInst>(V))
1000 const auto *ICmp = cast<ICmpInst>(I);
1000 const auto *ICmp = cast<ICmpInst>(I);
1006 case ICmpInst::ICMP_EQ:
1009 case ICmpInst::ICMP_NE:
1012 case ICmpInst::ICMP_UGT:
1015 case ICmpInst::ICMP_UGE:
1018 case ICmpInst::ICMP_ULT:
1021 case ICmpInst::ICMP_ULE:
1024 case ICmpInst::ICMP_SGT:
1028 case ICmpInst::ICMP_SGE:
1032 case ICmpInst::ICMP_SLT:
1036 case ICmpInst::ICMP_SLE:
lib/Target/WebAssembly/WebAssemblyLowerGlobalDtors.cpp 168 Value *Cmp = new ICmpInst(*EntryBB, ICmpInst::ICMP_NE, Res,
168 Value *Cmp = new ICmpInst(*EntryBB, ICmpInst::ICMP_NE, Res,
lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp 124 ICmpInst::Predicate Pred;
lib/Transforms/IPO/GlobalOpt.cpp 649 } else if (isa<ICmpInst>(U) &&
903 ICmpInst *ICI = dyn_cast<ICmpInst>(LoadUse.getUser());
903 ICmpInst *ICI = dyn_cast<ICmpInst>(LoadUse.getUser());
918 case ICmpInst::ICMP_ULT:
919 case ICmpInst::ICMP_SLT: // X < null -> always false
922 case ICmpInst::ICMP_ULE:
923 case ICmpInst::ICMP_SLE:
924 case ICmpInst::ICMP_EQ:
927 case ICmpInst::ICMP_NE:
928 case ICmpInst::ICMP_UGE:
929 case ICmpInst::ICMP_SGE:
930 case ICmpInst::ICMP_UGT:
931 case ICmpInst::ICMP_SGT:
1065 if (const ICmpInst *ICI = dyn_cast<ICmpInst>(UI)) {
1065 if (const ICmpInst *ICI = dyn_cast<ICmpInst>(UI)) {
1201 if (ICmpInst *SCI = dyn_cast<ICmpInst>(LoadUser)) {
1201 if (ICmpInst *SCI = dyn_cast<ICmpInst>(LoadUser)) {
1208 Value *New = new ICmpInst(SCI, SCI->getPredicate(), NPtr,
1336 Value *RunningOr = new ICmpInst(CI, ICmpInst::ICMP_SLT, CI->getArgOperand(0),
1336 Value *RunningOr = new ICmpInst(CI, ICmpInst::ICMP_SLT, CI->getArgOperand(0),
1339 Value *Cond = new ICmpInst(CI, ICmpInst::ICMP_EQ, FieldMallocs[i],
1339 Value *Cond = new ICmpInst(CI, ICmpInst::ICMP_EQ, FieldMallocs[i],
1367 Value *Cmp = new ICmpInst(*NullPtrBlock, ICmpInst::ICMP_NE, GVVal,
1367 Value *Cmp = new ICmpInst(*NullPtrBlock, ICmpInst::ICMP_NE, GVVal,
lib/Transforms/IPO/WholeProgramDevirt.cpp 1304 B.CreateICmp(IsOne ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE,
1304 B.CreateICmp(IsOne ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE,
lib/Transforms/InstCombine/InstCombineAddSub.cpp 1139 !match(C, m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ,
1157 ICmpInst::Predicate Pred;
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp 57 ICmpInst::Predicate NewPred;
174 ICmpInst::Predicate Pred = Inside ? ICmpInst::ICMP_ULT : ICmpInst::ICMP_UGE;
174 ICmpInst::Predicate Pred = Inside ? ICmpInst::ICMP_ULT : ICmpInst::ICMP_UGE;
174 ICmpInst::Predicate Pred = Inside ? ICmpInst::ICMP_ULT : ICmpInst::ICMP_UGE;
176 Pred = isSigned ? ICmpInst::getSignedPredicate(Pred) : Pred;
231 ICmpInst::Predicate Pred) {
235 bool IsEq = (Pred == ICmpInst::ICMP_EQ);
312 Value *&D, Value *&E, ICmpInst *LHS,
313 ICmpInst *RHS,
314 ICmpInst::Predicate &PredL,
315 ICmpInst::Predicate &PredR) {
349 if (!ICmpInst::isEquality(PredL))
391 if (!ICmpInst::isEquality(PredR))
442 ICmpInst *LHS, ICmpInst *RHS, bool IsAnd,
442 ICmpInst *LHS, ICmpInst *RHS, bool IsAnd,
444 ICmpInst::Predicate PredL, ICmpInst::Predicate PredR,
444 ICmpInst::Predicate PredL, ICmpInst::Predicate PredR,
469 ICmpInst::Predicate NewCC = IsAnd ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE;
469 ICmpInst::Predicate NewCC = IsAnd ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE;
469 ICmpInst::Predicate NewCC = IsAnd ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE;
572 ICmpInst *LHS, ICmpInst *RHS, bool IsAnd,
572 ICmpInst *LHS, ICmpInst *RHS, bool IsAnd,
574 ICmpInst::Predicate PredL, ICmpInst::Predicate PredR,
574 ICmpInst::Predicate PredL, ICmpInst::Predicate PredR,
606 static Value *foldLogOpOfMaskedICmps(ICmpInst *LHS, ICmpInst *RHS, bool IsAnd,
606 static Value *foldLogOpOfMaskedICmps(ICmpInst *LHS, ICmpInst *RHS, bool IsAnd,
609 ICmpInst::Predicate PredL = LHS->getPredicate(), PredR = RHS->getPredicate();
641 ICmpInst::Predicate NewCC = IsAnd ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE;
641 ICmpInst::Predicate NewCC = IsAnd ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE;
641 ICmpInst::Predicate NewCC = IsAnd ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE;
752 Value *InstCombiner::simplifyRangeCheck(ICmpInst *Cmp0, ICmpInst *Cmp1,
752 Value *InstCombiner::simplifyRangeCheck(ICmpInst *Cmp0, ICmpInst *Cmp1,
760 ICmpInst::Predicate Pred0 = (Inverted ? Cmp0->getInversePredicate() :
764 if (!((Pred0 == ICmpInst::ICMP_SGT && RangeStart->isMinusOne()) ||
765 (Pred0 == ICmpInst::ICMP_SGE && RangeStart->isZero())))
768 ICmpInst::Predicate Pred1 = (Inverted ? Cmp1->getInversePredicate() :
779 Pred1 = ICmpInst::getSwappedPredicate(Pred1);
785 ICmpInst::Predicate NewPred;
787 case ICmpInst::ICMP_SLT: NewPred = ICmpInst::ICMP_ULT; break;
787 case ICmpInst::ICMP_SLT: NewPred = ICmpInst::ICMP_ULT; break;
788 case ICmpInst::ICMP_SLE: NewPred = ICmpInst::ICMP_ULE; break;
788 case ICmpInst::ICMP_SLE: NewPred = ICmpInst::ICMP_ULE; break;
798 NewPred = ICmpInst::getInversePredicate(NewPred);
804 foldAndOrOfEqualityCmpsWithConstants(ICmpInst *LHS, ICmpInst *RHS,
804 foldAndOrOfEqualityCmpsWithConstants(ICmpInst *LHS, ICmpInst *RHS,
817 ICmpInst::Predicate Pred = LHS->getPredicate();
820 if (JoinedByAnd && Pred != ICmpInst::ICMP_NE)
822 if (!JoinedByAnd && Pred != ICmpInst::ICMP_EQ)
851 auto NewPred = JoinedByAnd ? ICmpInst::ICMP_UGT : ICmpInst::ICMP_ULE;
851 auto NewPred = JoinedByAnd ? ICmpInst::ICMP_UGT : ICmpInst::ICMP_ULE;
860 Value *InstCombiner::foldAndOrOfICmpsOfAndWithPow2(ICmpInst *LHS, ICmpInst *RHS,
860 Value *InstCombiner::foldAndOrOfICmpsOfAndWithPow2(ICmpInst *LHS, ICmpInst *RHS,
863 ICmpInst::Predicate Pred = LHS->getPredicate();
866 if (JoinedByAnd && Pred != ICmpInst::ICMP_NE)
868 if (!JoinedByAnd && Pred != ICmpInst::ICMP_EQ)
890 auto NewPred = JoinedByAnd ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE;
890 auto NewPred = JoinedByAnd ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE;
928 static Value *foldSignedTruncationCheck(ICmpInst *ICmp0, ICmpInst *ICmp1,
928 static Value *foldSignedTruncationCheck(ICmpInst *ICmp0, ICmpInst *ICmp1,
940 Pred == ICmpInst::ICMP_ULT && I1->ugt(*I01) && I01->shl(1) == *I1))
951 ICmpInst *OtherICmp;
969 Pred == ICmpInst::ICMP_EQ)
974 Pred == ICmpInst::ICMP_EQ) {
1023 static Value *foldIsPowerOf2(ICmpInst *Cmp0, ICmpInst *Cmp1, bool JoinedByAnd,
1023 static Value *foldIsPowerOf2(ICmpInst *Cmp0, ICmpInst *Cmp1, bool JoinedByAnd,
1026 if (JoinedByAnd && Cmp1->getPredicate() == ICmpInst::ICMP_NE)
1028 else if (!JoinedByAnd && Cmp1->getPredicate() == ICmpInst::ICMP_EQ)
1037 Pred0 == ICmpInst::ICMP_NE && Pred1 == ICmpInst::ICMP_ULT) {
1037 Pred0 == ICmpInst::ICMP_NE && Pred1 == ICmpInst::ICMP_ULT) {
1045 Pred0 == ICmpInst::ICMP_EQ && Pred1 == ICmpInst::ICMP_UGT) {
1045 Pred0 == ICmpInst::ICMP_EQ && Pred1 == ICmpInst::ICMP_UGT) {
1054 static Value *foldUnsignedUnderflowCheck(ICmpInst *ZeroICmp,
1055 ICmpInst *UnsignedICmp, bool IsAnd,
1059 ICmpInst::Predicate EqPred;
1061 !ICmpInst::isEquality(EqPred))
1068 ICmpInst::Predicate UnsignedPred;
1076 UnsignedPred = ICmpInst::getSwappedPredicate(UnsignedPred);
1092 if (UnsignedPred == ICmpInst::ICMP_ULE && EqPred == ICmpInst::ICMP_NE &&
1092 if (UnsignedPred == ICmpInst::ICMP_ULE && EqPred == ICmpInst::ICMP_NE &&
1095 if (UnsignedPred == ICmpInst::ICMP_ULT && EqPred == ICmpInst::ICMP_NE &&
1095 if (UnsignedPred == ICmpInst::ICMP_ULT && EqPred == ICmpInst::ICMP_NE &&
1098 if (UnsignedPred == ICmpInst::ICMP_UGT && EqPred == ICmpInst::ICMP_EQ &&
1098 if (UnsignedPred == ICmpInst::ICMP_UGT && EqPred == ICmpInst::ICMP_EQ &&
1101 if (UnsignedPred == ICmpInst::ICMP_UGE && EqPred == ICmpInst::ICMP_EQ &&
1101 if (UnsignedPred == ICmpInst::ICMP_UGE && EqPred == ICmpInst::ICMP_EQ &&
1112 !ICmpInst::isUnsigned(UnsignedPred))
1115 UnsignedPred = ICmpInst::getSwappedPredicate(UnsignedPred);
1119 if ((UnsignedPred == ICmpInst::ICMP_UGE ||
1120 UnsignedPred == ICmpInst::ICMP_UGT) &&
1121 EqPred == ICmpInst::ICMP_NE && IsAnd)
1126 if ((UnsignedPred == ICmpInst::ICMP_ULE ||
1127 UnsignedPred == ICmpInst::ICMP_ULT) &&
1128 EqPred == ICmpInst::ICMP_EQ && !IsAnd)
1132 if (UnsignedPred == ICmpInst::ICMP_ULE && EqPred == ICmpInst::ICMP_NE &&
1132 if (UnsignedPred == ICmpInst::ICMP_ULE && EqPred == ICmpInst::ICMP_NE &&
1137 if (UnsignedPred == ICmpInst::ICMP_UGT && EqPred == ICmpInst::ICMP_EQ &&
1137 if (UnsignedPred == ICmpInst::ICMP_UGT && EqPred == ICmpInst::ICMP_EQ &&
1145 Value *InstCombiner::foldAndOfICmps(ICmpInst *LHS, ICmpInst *RHS,
1145 Value *InstCombiner::foldAndOfICmps(ICmpInst *LHS, ICmpInst *RHS,
1154 ICmpInst::Predicate PredL = LHS->getPredicate(), PredR = RHS->getPredicate();
1209 if ((PredL == ICmpInst::ICMP_ULT && LHSC->getValue().isPowerOf2()) ||
1210 (PredL == ICmpInst::ICMP_EQ && LHSC->isZero())) {
1219 if (PredL == ICmpInst::ICMP_EQ && PredL == PredR && LHS->hasOneUse() &&
1258 if (PredL == ICmpInst::ICMP_UGE || PredL == ICmpInst::ICMP_ULE ||
1258 if (PredL == ICmpInst::ICMP_UGE || PredL == ICmpInst::ICMP_ULE ||
1259 PredR == ICmpInst::ICMP_UGE || PredR == ICmpInst::ICMP_ULE ||
1259 PredR == ICmpInst::ICMP_UGE || PredR == ICmpInst::ICMP_ULE ||
1260 PredL == ICmpInst::ICMP_SGE || PredL == ICmpInst::ICMP_SLE ||
1260 PredL == ICmpInst::ICMP_SGE || PredL == ICmpInst::ICMP_SLE ||
1261 PredR == ICmpInst::ICMP_SGE || PredR == ICmpInst::ICMP_SLE)
1261 PredR == ICmpInst::ICMP_SGE || PredR == ICmpInst::ICMP_SLE)
1271 (ICmpInst::isEquality(PredL) && CmpInst::isSigned(PredR)))
1293 case ICmpInst::ICMP_NE:
1297 case ICmpInst::ICMP_ULT:
1305 case ICmpInst::ICMP_SLT:
1314 case ICmpInst::ICMP_NE:
1319 case ICmpInst::ICMP_UGT:
1323 case ICmpInst::ICMP_NE:
1332 case ICmpInst::ICMP_ULT: // (X u> 13 & X u< 15) -> (X-14) u< 1
1337 case ICmpInst::ICMP_SGT:
1341 case ICmpInst::ICMP_NE:
1350 case ICmpInst::ICMP_SLT: // (X s> 13 & X s< 15) -> (X-14) u< 1
1580 ICmpInst *ICmp0 = dyn_cast<ICmpInst>(Cast0Src);
1580 ICmpInst *ICmp0 = dyn_cast<ICmpInst>(Cast0Src);
1581 ICmpInst *ICmp1 = dyn_cast<ICmpInst>(Cast1Src);
1581 ICmpInst *ICmp1 = dyn_cast<ICmpInst>(Cast1Src);
1915 ICmpInst *LHS = dyn_cast<ICmpInst>(Op0);
1915 ICmpInst *LHS = dyn_cast<ICmpInst>(Op0);
1916 ICmpInst *RHS = dyn_cast<ICmpInst>(Op1);
1916 ICmpInst *RHS = dyn_cast<ICmpInst>(Op1);
1925 if (auto *Cmp = dyn_cast<ICmpInst>(X))
1925 if (auto *Cmp = dyn_cast<ICmpInst>(X))
1928 if (auto *Cmp = dyn_cast<ICmpInst>(Y))
1928 if (auto *Cmp = dyn_cast<ICmpInst>(Y))
1933 if (auto *Cmp = dyn_cast<ICmpInst>(X))
1933 if (auto *Cmp = dyn_cast<ICmpInst>(X))
1936 if (auto *Cmp = dyn_cast<ICmpInst>(Y))
1936 if (auto *Cmp = dyn_cast<ICmpInst>(Y))
2187 Value *InstCombiner::foldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS,
2187 Value *InstCombiner::foldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS,
2196 ICmpInst::Predicate PredL = LHS->getPredicate(), PredR = RHS->getPredicate();
2212 if ((PredL == ICmpInst::ICMP_ULT || PredL == ICmpInst::ICMP_ULE) &&
2212 if ((PredL == ICmpInst::ICMP_ULT || PredL == ICmpInst::ICMP_ULE) &&
2280 if (PredL == ICmpInst::ICMP_EQ && LHSC && LHSC->isZero()) {
2282 if (PredR == ICmpInst::ICMP_ULT && LHS0 == RHS->getOperand(1))
2284 else if (PredR == ICmpInst::ICMP_UGT && LHS0 == RHS0)
2289 else if (PredR == ICmpInst::ICMP_EQ && RHSC && RHSC->isZero()) {
2291 if (PredL == ICmpInst::ICMP_ULT && RHS0 == LHS->getOperand(1))
2293 else if (PredL == ICmpInst::ICMP_UGT && LHS0 == RHS0)
2298 ICmpInst::ICMP_UGE,
2329 if (PredL == ICmpInst::ICMP_NE && LHSC->isZero()) {
2337 if (PredL == ICmpInst::ICMP_ULT && PredR == ICmpInst::ICMP_EQ) {
2337 if (PredL == ICmpInst::ICMP_ULT && PredR == ICmpInst::ICMP_EQ) {
2350 if (PredL == ICmpInst::ICMP_UGE || PredL == ICmpInst::ICMP_ULE ||
2350 if (PredL == ICmpInst::ICMP_UGE || PredL == ICmpInst::ICMP_ULE ||
2351 PredR == ICmpInst::ICMP_UGE || PredR == ICmpInst::ICMP_ULE ||
2351 PredR == ICmpInst::ICMP_UGE || PredR == ICmpInst::ICMP_ULE ||
2352 PredL == ICmpInst::ICMP_SGE || PredL == ICmpInst::ICMP_SLE ||
2352 PredL == ICmpInst::ICMP_SGE || PredL == ICmpInst::ICMP_SLE ||
2353 PredR == ICmpInst::ICMP_SGE || PredR == ICmpInst::ICMP_SLE)
2353 PredR == ICmpInst::ICMP_SGE || PredR == ICmpInst::ICMP_SLE)
2363 (ICmpInst::isEquality(PredL) && CmpInst::isSigned(PredR)))
2385 case ICmpInst::ICMP_EQ:
2389 case ICmpInst::ICMP_EQ:
2392 case ICmpInst::ICMP_UGT:
2399 case ICmpInst::ICMP_SGT:
2408 case ICmpInst::ICMP_ULT:
2412 case ICmpInst::ICMP_EQ: // (X u< 13 | X == 14) -> no change
2418 case ICmpInst::ICMP_UGT: // (X u< 13 | X u> 15) -> (X-13) u> 2
2424 case ICmpInst::ICMP_SLT:
2428 case ICmpInst::ICMP_EQ:
2435 case ICmpInst::ICMP_SGT: // (X s< 13 | X s> 15) -> (X-13) u> 2
2640 ICmpInst *LHS = dyn_cast<ICmpInst>(Op0);
2640 ICmpInst *LHS = dyn_cast<ICmpInst>(Op0);
2641 ICmpInst *RHS = dyn_cast<ICmpInst>(Op1);
2641 ICmpInst *RHS = dyn_cast<ICmpInst>(Op1);
2650 if (auto *Cmp = dyn_cast<ICmpInst>(X))
2650 if (auto *Cmp = dyn_cast<ICmpInst>(X))
2653 if (auto *Cmp = dyn_cast<ICmpInst>(Y))
2653 if (auto *Cmp = dyn_cast<ICmpInst>(Y))
2658 if (auto *Cmp = dyn_cast<ICmpInst>(X))
2658 if (auto *Cmp = dyn_cast<ICmpInst>(X))
2661 if (auto *Cmp = dyn_cast<ICmpInst>(Y))
2661 if (auto *Cmp = dyn_cast<ICmpInst>(Y))
2797 Value *InstCombiner::foldXorOfICmps(ICmpInst *LHS, ICmpInst *RHS,
2797 Value *InstCombiner::foldXorOfICmps(ICmpInst *LHS, ICmpInst *RHS,
2819 ICmpInst::Predicate PredL = LHS->getPredicate(), PredR = RHS->getPredicate();
2856 ICmpInst *X = nullptr, *Y = nullptr;
3207 if (auto *LHS = dyn_cast<ICmpInst>(I.getOperand(0)))
3207 if (auto *LHS = dyn_cast<ICmpInst>(I.getOperand(0)))
3208 if (auto *RHS = dyn_cast<ICmpInst>(I.getOperand(1)))
3208 if (auto *RHS = dyn_cast<ICmpInst>(I.getOperand(1)))
lib/Transforms/InstCombine/InstCombineCalls.cpp 3955 Pred == ICmpInst::ICMP_NE && LHS->getOpcode() == Instruction::Load &&
lib/Transforms/InstCombine/InstCombineCasts.cpp 732 return new ICmpInst(ICmpInst::ICMP_NE, And, Zero);
732 return new ICmpInst(ICmpInst::ICMP_NE, And, Zero);
743 return new ICmpInst(ICmpInst::ICMP_NE, And, Zero);
743 return new ICmpInst(ICmpInst::ICMP_NE, And, Zero);
750 return new ICmpInst(ICmpInst::ICMP_NE, And, Zero);
750 return new ICmpInst(ICmpInst::ICMP_NE, And, Zero);
846 Instruction *InstCombiner::transformZExtICmp(ICmpInst *ICI, ZExtInst &CI,
856 if ((ICI->getPredicate() == ICmpInst::ICMP_SLT && Op1CV->isNullValue()) ||
857 (ICI->getPredicate() == ICmpInst::ICMP_SGT && Op1CV->isAllOnesValue())) {
867 if (ICI->getPredicate() == ICmpInst::ICMP_SGT) {
893 bool isNE = ICI->getPredicate() == ICmpInst::ICMP_NE;
952 if (ICI->getPredicate() == ICmpInst::ICMP_EQ)
1175 if (ICmpInst *ICI = dyn_cast<ICmpInst>(Src))
1175 if (ICmpInst *ICI = dyn_cast<ICmpInst>(Src))
1183 ICmpInst *LHS = dyn_cast<ICmpInst>(SrcI->getOperand(0));
1183 ICmpInst *LHS = dyn_cast<ICmpInst>(SrcI->getOperand(0));
1184 ICmpInst *RHS = dyn_cast<ICmpInst>(SrcI->getOperand(1));
1184 ICmpInst *RHS = dyn_cast<ICmpInst>(SrcI->getOperand(1));
1224 Instruction *InstCombiner::transformSExtICmp(ICmpInst *ICI, Instruction &CI) {
1226 ICmpInst::Predicate Pred = ICI->getPredicate();
1232 if ((Pred == ICmpInst::ICMP_SLT && match(Op1, m_ZeroInt())) ||
1233 (Pred == ICmpInst::ICMP_SGT && match(Op1, m_AllOnes()))) {
1242 if (Pred == ICmpInst::ICMP_SGT)
1261 Value *V = Pred == ICmpInst::ICMP_NE ?
1267 if (!Op1C->isZero() == (Pred == ICmpInst::ICMP_NE)) {
1413 if (ICmpInst *ICI = dyn_cast<ICmpInst>(Src))
1413 if (ICmpInst *ICI = dyn_cast<ICmpInst>(Src))
lib/Transforms/InstCombine/InstCombineCompares.cpp 65 static bool hasBranchUse(ICmpInst &I) {
76 static bool isSignTest(ICmpInst::Predicate &Pred, const APInt &C) {
77 if (!ICmpInst::isSigned(Pred))
81 return ICmpInst::isRelational(Pred);
84 if (Pred == ICmpInst::ICMP_SLT) {
85 Pred = ICmpInst::ICMP_SLE;
89 if (Pred == ICmpInst::ICMP_SGT) {
90 Pred = ICmpInst::ICMP_SGE;
331 return new ICmpInst(ICmpInst::ICMP_EQ, Idx, FirstTrueIdx);
331 return new ICmpInst(ICmpInst::ICMP_EQ, Idx, FirstTrueIdx);
351 return new ICmpInst(ICmpInst::ICMP_NE, Idx, FirstFalseIdx);
351 return new ICmpInst(ICmpInst::ICMP_NE, Idx, FirstFalseIdx);
373 return new ICmpInst(ICmpInst::ICMP_ULT, Idx, End);
373 return new ICmpInst(ICmpInst::ICMP_ULT, Idx, End);
387 return new ICmpInst(ICmpInst::ICMP_UGT, Idx, End);
387 return new ICmpInst(ICmpInst::ICMP_UGT, Idx, End);
408 return new ICmpInst(ICmpInst::ICMP_NE, V, ConstantInt::get(Ty, 0));
408 return new ICmpInst(ICmpInst::ICMP_NE, V, ConstantInt::get(Ty, 0));
805 ICmpInst::Predicate Cond,
839 return new ICmpInst(ICmpInst::getSignedPredicate(Cond), Index, NewRHS);
839 return new ICmpInst(ICmpInst::getSignedPredicate(Cond), Index, NewRHS);
845 ICmpInst::Predicate Cond,
852 if (ICmpInst::isSigned(Cond))
873 return new ICmpInst(ICmpInst::getSignedPredicate(Cond), Offset,
873 return new ICmpInst(ICmpInst::getSignedPredicate(Cond), Offset,
877 if (GEPLHS->isInBounds() && ICmpInst::isEquality(Cond) &&
903 return new ICmpInst(Cond, Base,
923 return new ICmpInst(Cond, GEPLHS->getOperand(0), GEPRHS->getOperand(0));
951 Value *Cmp = Builder.CreateICmp(ICmpInst::getSignedPredicate(Cond),
966 ICmpInst::getSwappedPredicate(Cond), I);
998 ConstantInt::get(I.getType(), ICmpInst::isTrueWhenEqual(Cond)));
1004 return new ICmpInst(ICmpInst::getSignedPredicate(Cond), LHSV, RHSV);
1004 return new ICmpInst(ICmpInst::getSignedPredicate(Cond), LHSV, RHSV);
1015 return new ICmpInst(ICmpInst::getSignedPredicate(Cond), L, R);
1015 return new ICmpInst(ICmpInst::getSignedPredicate(Cond), L, R);
1024 Instruction *InstCombiner::foldAllocaCmp(ICmpInst &ICI,
1070 } else if (isa<ICmpInst>(V)) {
1103 ICmpInst::Predicate Pred) {
1112 if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_ULE) {
1112 if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_ULE) {
1115 return new ICmpInst(ICmpInst::ICMP_UGT, X, R);
1115 return new ICmpInst(ICmpInst::ICMP_UGT, X, R);
1121 if (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_UGE)
1121 if (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_UGE)
1122 return new ICmpInst(ICmpInst::ICMP_ULT, X,
1122 return new ICmpInst(ICmpInst::ICMP_ULT, X,
1133 if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SLE)
1133 if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SLE)
1134 return new ICmpInst(ICmpInst::ICMP_SGT, X,
1134 return new ICmpInst(ICmpInst::ICMP_SGT, X,
1145 return new ICmpInst(ICmpInst::ICMP_SLT, X,
1145 return new ICmpInst(ICmpInst::ICMP_SLT, X,
1152 Instruction *InstCombiner::foldICmpShrConstConst(ICmpInst &I, Value *A,
1160 return new ICmpInst(Pred, LHS, RHS);
1211 Instruction *InstCombiner::foldICmpShlConstConst(ICmpInst &I, Value *A,
1219 return new ICmpInst(Pred, LHS, RHS);
1255 static Instruction *processUGT_ADDCST_ADD(ICmpInst &I, Value *A, Value *B,
1342 Instruction *InstCombiner::foldIRemByPowerOfTwoToBitTest(ICmpInst &I) {
1346 ICmpInst::Predicate Pred;
1356 return ICmpInst::Create(Instruction::ICmp, Pred, Masked, Zero);
1361 Instruction *InstCombiner::foldSignBitTest(ICmpInst &I) {
1363 ICmpInst::Predicate Pred;
1374 if (!match(C, m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ,
1385 return ICmpInst::Create(Instruction::ICmp,
1386 Pred == ICmpInst::ICMP_EQ ? ICmpInst::ICMP_SGE
1386 Pred == ICmpInst::ICMP_EQ ? ICmpInst::ICMP_SGE
1387 : ICmpInst::ICMP_SLT,
1392 Instruction *InstCombiner::foldICmpWithZero(ICmpInst &Cmp) {
1398 if (Pred == ICmpInst::ICMP_SGT) {
1403 return new ICmpInst(Pred, B, Cmp.getOperand(1));
1405 return new ICmpInst(Pred, A, Cmp.getOperand(1));
1418 ICmpInst::isEquality(Pred)) {
1422 return new ICmpInst(Pred, X, Cmp.getOperand(1));
1433 Instruction *InstCombiner::foldICmpWithConstant(ICmpInst &Cmp) {
1449 if (Pred == ICmpInst::ICMP_UGT && match(Op1, m_ConstantInt(CI)) &&
1458 Instruction *InstCombiner::foldICmpWithDominatingICmp(ICmpInst &Cmp) {
1485 ICmpInst::Predicate DomPred;
1519 return new ICmpInst(ICmpInst::ICMP_EQ, X, Builder.getInt(*EqC));
1519 return new ICmpInst(ICmpInst::ICMP_EQ, X, Builder.getInt(*EqC));
1521 return new ICmpInst(ICmpInst::ICMP_NE, X, Builder.getInt(*NeC));
1521 return new ICmpInst(ICmpInst::ICMP_NE, X, Builder.getInt(*NeC));
1528 Instruction *InstCombiner::foldICmpTruncConstant(ICmpInst &Cmp,
1531 ICmpInst::Predicate Pred = Cmp.getPredicate();
1536 if (Pred == ICmpInst::ICMP_SLT && match(X, m_Signum(m_Value(V))))
1537 return new ICmpInst(ICmpInst::ICMP_SLT, V,
1537 return new ICmpInst(ICmpInst::ICMP_SLT, V,
1553 return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), NewRHS));
1561 Instruction *InstCombiner::foldICmpXorConstant(ICmpInst &Cmp,
1572 ICmpInst::Predicate Pred = Cmp.getPredicate();
1586 return new ICmpInst(ICmpInst::ICMP_SGT, X,
1586 return new ICmpInst(ICmpInst::ICMP_SGT, X,
1589 return new ICmpInst(ICmpInst::ICMP_SLT, X,
1589 return new ICmpInst(ICmpInst::ICMP_SLT, X,
1598 return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), C ^ *XorC));
1606 return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), C ^ *XorC));
1611 if (Pred == ICmpInst::ICMP_UGT) {
1614 return new ICmpInst(ICmpInst::ICMP_ULT, X, Y);
1614 return new ICmpInst(ICmpInst::ICMP_ULT, X, Y);
1617 return new ICmpInst(ICmpInst::ICMP_UGT, X, Y);
1617 return new ICmpInst(ICmpInst::ICMP_UGT, X, Y);
1619 if (Pred == ICmpInst::ICMP_ULT) {
1622 return new ICmpInst(ICmpInst::ICMP_UGT, X,
1622 return new ICmpInst(ICmpInst::ICMP_UGT, X,
1626 return new ICmpInst(ICmpInst::ICMP_UGT, X,
1626 return new ICmpInst(ICmpInst::ICMP_UGT, X,
1633 Instruction *InstCombiner::foldICmpAndShift(ICmpInst &Cmp, BinaryOperator *And,
1681 if (Cmp.getPredicate() == ICmpInst::ICMP_EQ)
1683 if (Cmp.getPredicate() == ICmpInst::ICMP_NE)
1716 Instruction *InstCombiner::foldICmpAndConstConst(ICmpInst &Cmp,
1719 bool isICMP_NE = Cmp.getPredicate() == ICmpInst::ICMP_NE;
1742 auto NewPred = isICMP_NE ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_SGE;
1742 auto NewPred = isICMP_NE ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_SGE;
1743 return new ICmpInst(NewPred, X, Zero);
1751 auto NewPred = isICMP_NE ? ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT;
1751 auto NewPred = isICMP_NE ? ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT;
1752 return new ICmpInst(NewPred, X, NegBOC);
1776 return new ICmpInst(Cmp.getPredicate(), NewAnd, ZextC1);
1825 Instruction *InstCombiner::foldICmpAndConstant(ICmpInst &Cmp,
1855 return new ICmpInst(NewPred, X, SubOne(cast<Constant>(Cmp.getOperand(1))));
1871 return new ICmpInst(NewPred, Trunc, Constant::getNullValue(NTy));
1879 Instruction *InstCombiner::foldICmpOrConstant(ICmpInst &Cmp, BinaryOperator *Or,
1881 ICmpInst::Predicate Pred = Cmp.getPredicate();
1885 if (Pred == ICmpInst::ICMP_SLT && match(Or, m_Signum(m_Value(V))))
1886 return new ICmpInst(ICmpInst::ICMP_SLT, V,
1886 return new ICmpInst(ICmpInst::ICMP_SLT, V,
1897 return new ICmpInst(Pred, OrOp0, OrOp1);
1904 return new ICmpInst(Pred, A, ConstantInt::getNullValue(OrOp0->getType()));
1940 Instruction *InstCombiner::foldICmpMulConstant(ICmpInst &Cmp,
1949 ICmpInst::Predicate Pred = Cmp.getPredicate();
1952 Pred = ICmpInst::getSwappedPredicate(Pred);
1953 return new ICmpInst(Pred, Mul->getOperand(0),
1961 static Instruction *foldICmpShlOne(ICmpInst &Cmp, Instruction *Shl,
1970 ICmpInst::Predicate Pred = Cmp.getPredicate();
1978 if (Pred == ICmpInst::ICMP_ULT)
1979 Pred = ICmpInst::ICMP_ULE;
1980 else if (Pred == ICmpInst::ICMP_UGE)
1981 Pred = ICmpInst::ICMP_UGT;
1988 if (Pred == ICmpInst::ICMP_UGE)
1989 Pred = ICmpInst::ICMP_EQ;
1990 else if (Pred == ICmpInst::ICMP_ULT)
1991 Pred = ICmpInst::ICMP_NE;
1993 return new ICmpInst(Pred, Y, ConstantInt::get(ShiftType, CLog2));
1998 if (Pred == ICmpInst::ICMP_SLE)
1999 return new ICmpInst(ICmpInst::ICMP_EQ, Y, BitWidthMinusOne);
1999 return new ICmpInst(ICmpInst::ICMP_EQ, Y, BitWidthMinusOne);
2002 if (Pred == ICmpInst::ICMP_SGT)
2003 return new ICmpInst(ICmpInst::ICMP_NE, Y, BitWidthMinusOne);
2003 return new ICmpInst(ICmpInst::ICMP_NE, Y, BitWidthMinusOne);
2007 if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SLE)
2007 if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SLE)
2008 return new ICmpInst(ICmpInst::ICMP_EQ, Y, BitWidthMinusOne);
2008 return new ICmpInst(ICmpInst::ICMP_EQ, Y, BitWidthMinusOne);
2012 if (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SGE)
2012 if (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SGE)
2013 return new ICmpInst(ICmpInst::ICMP_NE, Y, BitWidthMinusOne);
2013 return new ICmpInst(ICmpInst::ICMP_NE, Y, BitWidthMinusOne);
2016 return new ICmpInst(Pred, Y, ConstantInt::get(ShiftType, C.logBase2()));
2023 Instruction *InstCombiner::foldICmpShlConstant(ICmpInst &Cmp,
2040 ICmpInst::Predicate Pred = Cmp.getPredicate();
2048 if (Pred == ICmpInst::ICMP_SGT) {
2051 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC));
2053 if ((Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_NE) &&
2053 if ((Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_NE) &&
2056 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC));
2058 if (Pred == ICmpInst::ICMP_SLT) {
2065 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC));
2071 return new ICmpInst(Pred, X, Constant::getNullValue(ShType));
2078 if (Pred == ICmpInst::ICMP_UGT) {
2081 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC));
2083 if ((Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_NE) &&
2083 if ((Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_NE) &&
2086 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC));
2088 if (Pred == ICmpInst::ICMP_ULT) {
2095 return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC));
2106 return new ICmpInst(Pred, And, LShrC);
2117 return new ICmpInst(TrueIfSigned ? ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ,
2117 return new ICmpInst(TrueIfSigned ? ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ,
2117 return new ICmpInst(TrueIfSigned ? ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ,
2125 (Pred == ICmpInst::ICMP_ULE || Pred == ICmpInst::ICMP_UGT)) {
2125 (Pred == ICmpInst::ICMP_ULE || Pred == ICmpInst::ICMP_UGT)) {
2127 return new ICmpInst(Pred == ICmpInst::ICMP_ULE ? ICmpInst::ICMP_EQ
2127 return new ICmpInst(Pred == ICmpInst::ICMP_ULE ? ICmpInst::ICMP_EQ
2127 return new ICmpInst(Pred == ICmpInst::ICMP_ULE ? ICmpInst::ICMP_EQ
2128 : ICmpInst::ICMP_NE,
2133 (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_UGE)) {
2133 (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_UGE)) {
2136 return new ICmpInst(Pred == ICmpInst::ICMP_ULT ? ICmpInst::ICMP_EQ
2136 return new ICmpInst(Pred == ICmpInst::ICMP_ULT ? ICmpInst::ICMP_EQ
2136 return new ICmpInst(Pred == ICmpInst::ICMP_ULT ? ICmpInst::ICMP_EQ
2137 : ICmpInst::ICMP_NE,
2156 return new ICmpInst(Pred, Builder.CreateTrunc(X, TruncTy), NewC);
2163 Instruction *InstCombiner::foldICmpShrConstant(ICmpInst &Cmp,
2172 return new ICmpInst(Pred, X, Cmp.getOperand(1));
2202 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, ShiftedC));
2209 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, ShiftedC));
2217 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, ShiftedC));
2223 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, ShiftedC));
2242 return new ICmpInst(Pred, X, ConstantInt::get(ShrTy, C << ShAmtVal));
2250 return new ICmpInst(Pred, And, ConstantInt::get(ShrTy, C << ShAmtVal));
2256 Instruction *InstCombiner::foldICmpSRemConstant(ICmpInst &Cmp,
2262 const ICmpInst::Predicate Pred = Cmp.getPredicate();
2263 if (Pred != ICmpInst::ICMP_SGT && Pred != ICmpInst::ICMP_SLT)
2263 if (Pred != ICmpInst::ICMP_SGT && Pred != ICmpInst::ICMP_SLT)
2285 if (Pred == ICmpInst::ICMP_SGT)
2286 return new ICmpInst(ICmpInst::ICMP_SGT, And, ConstantInt::getNullValue(Ty));
2286 return new ICmpInst(ICmpInst::ICMP_SGT, And, ConstantInt::getNullValue(Ty));
2291 return new ICmpInst(ICmpInst::ICMP_UGT, And, ConstantInt::get(Ty, SignMask));
2291 return new ICmpInst(ICmpInst::ICMP_UGT, And, ConstantInt::get(Ty, SignMask));
2295 Instruction *InstCombiner::foldICmpUDivConstant(ICmpInst &Cmp,
2306 if (Cmp.getPredicate() == ICmpInst::ICMP_UGT) {
2309 return new ICmpInst(ICmpInst::ICMP_ULE, Y,
2309 return new ICmpInst(ICmpInst::ICMP_ULE, Y,
2314 if (Cmp.getPredicate() == ICmpInst::ICMP_ULT) {
2316 return new ICmpInst(ICmpInst::ICMP_UGT, Y,
2316 return new ICmpInst(ICmpInst::ICMP_UGT, Y,
2324 Instruction *InstCombiner::foldICmpDivConstant(ICmpInst &Cmp,
2368 ICmpInst::Predicate Pred = Cmp.getPredicate();
2437 Pred = ICmpInst::getSwappedPredicate(Pred);
2443 case ICmpInst::ICMP_EQ:
2447 return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE :
2447 return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE :
2448 ICmpInst::ICMP_UGE, X,
2451 return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT :
2451 return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT :
2452 ICmpInst::ICMP_ULT, X,
2456 case ICmpInst::ICMP_NE:
2460 return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT :
2460 return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT :
2461 ICmpInst::ICMP_ULT, X,
2464 return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE :
2464 return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE :
2465 ICmpInst::ICMP_UGE, X,
2470 case ICmpInst::ICMP_ULT:
2471 case ICmpInst::ICMP_SLT:
2476 return new ICmpInst(Pred, X, ConstantInt::get(Div->getType(), LoBound));
2477 case ICmpInst::ICMP_UGT:
2478 case ICmpInst::ICMP_SGT:
2483 if (Pred == ICmpInst::ICMP_UGT)
2484 return new ICmpInst(ICmpInst::ICMP_UGE, X,
2484 return new ICmpInst(ICmpInst::ICMP_UGE, X,
2486 return new ICmpInst(ICmpInst::ICMP_SGE, X,
2486 return new ICmpInst(ICmpInst::ICMP_SGE, X,
2494 Instruction *InstCombiner::foldICmpSubConstant(ICmpInst &Cmp,
2498 ICmpInst::Predicate Pred = Cmp.getPredicate();
2504 return new ICmpInst(Cmp.getPredicate(), Y,
2512 return new ICmpInst(Cmp.getSwappedPredicate(), Y,
2522 if (Pred == ICmpInst::ICMP_SGT && C.isAllOnesValue())
2523 return new ICmpInst(ICmpInst::ICMP_SGE, X, Y);
2523 return new ICmpInst(ICmpInst::ICMP_SGE, X, Y);
2526 if (Pred == ICmpInst::ICMP_SGT && C.isNullValue())
2527 return new ICmpInst(ICmpInst::ICMP_SGT, X, Y);
2527 return new ICmpInst(ICmpInst::ICMP_SGT, X, Y);
2530 if (Pred == ICmpInst::ICMP_SLT && C.isNullValue())
2531 return new ICmpInst(ICmpInst::ICMP_SLT, X, Y);
2531 return new ICmpInst(ICmpInst::ICMP_SLT, X, Y);
2534 if (Pred == ICmpInst::ICMP_SLT && C.isOneValue())
2535 return new ICmpInst(ICmpInst::ICMP_SLE, X, Y);
2535 return new ICmpInst(ICmpInst::ICMP_SLE, X, Y);
2543 if (Pred == ICmpInst::ICMP_ULT && C.isPowerOf2() &&
2545 return new ICmpInst(ICmpInst::ICMP_EQ, Builder.CreateOr(Y, C - 1), X);
2545 return new ICmpInst(ICmpInst::ICMP_EQ, Builder.CreateOr(Y, C - 1), X);
2549 if (Pred == ICmpInst::ICMP_UGT && (C + 1).isPowerOf2() && (*C2 & C) == C)
2550 return new ICmpInst(ICmpInst::ICMP_NE, Builder.CreateOr(Y, C), X);
2550 return new ICmpInst(ICmpInst::ICMP_NE, Builder.CreateOr(Y, C), X);
2556 Instruction *InstCombiner::foldICmpAddConstant(ICmpInst &Cmp,
2576 (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SLT)) ||
2576 (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SLT)) ||
2578 (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_ULT))) {
2578 (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_ULT))) {
2587 return new ICmpInst(Pred, X, ConstantInt::get(Ty, NewC));
2595 return new ICmpInst(ICmpInst::ICMP_SLT, X, ConstantInt::get(Ty, Upper));
2595 return new ICmpInst(ICmpInst::ICMP_SLT, X, ConstantInt::get(Ty, Upper));
2597 return new ICmpInst(ICmpInst::ICMP_SGE, X, ConstantInt::get(Ty, Lower));
2597 return new ICmpInst(ICmpInst::ICMP_SGE, X, ConstantInt::get(Ty, Lower));
2600 return new ICmpInst(ICmpInst::ICMP_ULT, X, ConstantInt::get(Ty, Upper));
2600 return new ICmpInst(ICmpInst::ICMP_ULT, X, ConstantInt::get(Ty, Upper));
2602 return new ICmpInst(ICmpInst::ICMP_UGE, X, ConstantInt::get(Ty, Lower));
2602 return new ICmpInst(ICmpInst::ICMP_UGE, X, ConstantInt::get(Ty, Lower));
2608 if (Pred == ICmpInst::ICMP_ULT && C.isPowerOf2() && (*C2 & (C - 1)) == 0)
2609 return new ICmpInst(ICmpInst::ICMP_EQ, Builder.CreateAnd(X, -C),
2609 return new ICmpInst(ICmpInst::ICMP_EQ, Builder.CreateAnd(X, -C),
2615 if (Pred == ICmpInst::ICMP_UGT && (C + 1).isPowerOf2() && (*C2 & C) == 0)
2616 return new ICmpInst(ICmpInst::ICMP_NE, Builder.CreateAnd(X, ~C),
2616 return new ICmpInst(ICmpInst::ICMP_NE, Builder.CreateAnd(X, ~C),
2633 ICmpInst::Predicate PredA;
2635 !ICmpInst::isEquality(PredA))
2640 if (PredA == ICmpInst::ICMP_NE)
2644 ICmpInst::Predicate PredB;
2654 PredB = ICmpInst::getSwappedPredicate(PredB);
2659 if (PredB == ICmpInst::ICMP_SGT && isa<Constant>(RHS2)) {
2669 PredB = ICmpInst::ICMP_SLT;
2671 return PredB == ICmpInst::ICMP_SLT && RHS == RHS2;
2674 Instruction *InstCombiner::foldICmpSelectConstant(ICmpInst &Cmp,
2711 Cond = Builder.CreateOr(Cond, Builder.CreateICmp(ICmpInst::ICMP_SLT,
2714 Cond = Builder.CreateOr(Cond, Builder.CreateICmp(ICmpInst::ICMP_EQ,
2717 Cond = Builder.CreateOr(Cond, Builder.CreateICmp(ICmpInst::ICMP_SGT,
2725 static Instruction *foldICmpBitCast(ICmpInst &Cmp,
2731 ICmpInst::Predicate Pred = Cmp.getPredicate();
2745 if ((Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_SLT ||
2745 if ((Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_SLT ||
2746 Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SGT) &&
2746 Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SGT) &&
2748 return new ICmpInst(Pred, X, ConstantInt::getNullValue(X->getType()));
2751 if (Pred == ICmpInst::ICMP_SLT && match(Op1, m_One()))
2752 return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), 1));
2755 if (Pred == ICmpInst::ICMP_SGT && match(Op1, m_AllOnes()))
2756 return new ICmpInst(Pred, X,
2765 return new ICmpInst(Pred, X, ConstantInt::getNullValue(X->getType()));
2778 return new ICmpInst(Pred, BCSrcOp, Op1);
2810 return new ICmpInst(Pred, Extract, NewC);
2819 Instruction *InstCombiner::foldICmpInstWithConstant(ICmpInst &Cmp) {
2904 Instruction *InstCombiner::foldICmpBinOpEqualityWithConstant(ICmpInst &Cmp,
2912 ICmpInst::Predicate Pred = Cmp.getPredicate();
2913 bool isICMP_NE = Pred == ICmpInst::ICMP_NE;
2924 return new ICmpInst(Pred, NewRem,
2935 return new ICmpInst(Pred, BOp0, SubC);
2941 return new ICmpInst(Pred, BOp0, NegVal);
2943 return new ICmpInst(Pred, NegVal, BOp1);
2947 return new ICmpInst(Pred, BOp0, Neg);
2957 return new ICmpInst(Pred, BOp0, ConstantExpr::getXor(RHS, BOC));
2960 return new ICmpInst(Pred, BOp0, BOp1);
2970 return new ICmpInst(Pred, BOp1, SubC);
2973 return new ICmpInst(Pred, BOp0, BOp1);
2985 return new ICmpInst(Pred, And, NotBOC);
2994 return new ICmpInst(isICMP_NE ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE,
2994 return new ICmpInst(isICMP_NE ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE,
2994 return new ICmpInst(isICMP_NE ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE,
3006 return new ICmpInst(Pred, BOp0, Constant::getNullValue(RHS->getType()));
3013 auto NewPred = isICMP_NE ? ICmpInst::ICMP_ULE : ICmpInst::ICMP_UGT;
3013 auto NewPred = isICMP_NE ? ICmpInst::ICMP_ULE : ICmpInst::ICMP_UGT;
3014 return new ICmpInst(NewPred, BOp1, BOp0);
3024 Instruction *InstCombiner::foldICmpEqIntrinsicWithConstant(ICmpInst &Cmp,
3094 ICmpInst::Predicate NewPred = Cmp.getPredicate() == ICmpInst::ICMP_EQ
3094 ICmpInst::Predicate NewPred = Cmp.getPredicate() == ICmpInst::ICMP_EQ
3095 ? ICmpInst::ICMP_ULE : ICmpInst::ICMP_UGT;
3095 ? ICmpInst::ICMP_ULE : ICmpInst::ICMP_UGT;
3096 return ICmpInst::Create(Instruction::ICmp, NewPred,
3109 Instruction *InstCombiner::foldICmpIntrinsicWithConstant(ICmpInst &Cmp,
3120 if (Cmp.getPredicate() == ICmpInst::ICMP_UGT && C.ult(BitWidth)) {
3123 return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_ULT,
3128 if (Cmp.getPredicate() == ICmpInst::ICMP_ULT &&
3132 return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_UGT,
3143 if (Cmp.getPredicate() == ICmpInst::ICMP_UGT && C.ult(BitWidth)) {
3145 return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ,
3151 if (Cmp.getPredicate() == ICmpInst::ICMP_ULT &&
3154 return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE,
3168 Instruction *InstCombiner::foldICmpInstWithConstantNotInt(ICmpInst &I) {
3180 return new ICmpInst(
3244 return new ICmpInst(
3278 static Value *foldICmpWithLowBitMaskedVal(ICmpInst &I,
3280 ICmpInst::Predicate SrcPred;
3293 ICmpInst::Predicate DstPred;
3295 case ICmpInst::Predicate::ICMP_EQ:
3297 DstPred = ICmpInst::Predicate::ICMP_ULE;
3299 case ICmpInst::Predicate::ICMP_NE:
3301 DstPred = ICmpInst::Predicate::ICMP_UGT;
3303 case ICmpInst::Predicate::ICMP_UGT:
3306 DstPred = ICmpInst::Predicate::ICMP_UGT;
3308 case ICmpInst::Predicate::ICMP_UGE:
3311 DstPred = ICmpInst::Predicate::ICMP_ULE;
3313 case ICmpInst::Predicate::ICMP_ULT:
3316 DstPred = ICmpInst::Predicate::ICMP_UGT;
3318 case ICmpInst::Predicate::ICMP_ULE:
3321 DstPred = ICmpInst::Predicate::ICMP_ULE;
3323 case ICmpInst::Predicate::ICMP_SGT:
3331 DstPred = ICmpInst::Predicate::ICMP_SGT;
3333 case ICmpInst::Predicate::ICMP_SGE:
3341 DstPred = ICmpInst::Predicate::ICMP_SLE;
3343 case ICmpInst::Predicate::ICMP_SLT:
3351 DstPred = ICmpInst::Predicate::ICMP_SGT;
3353 case ICmpInst::Predicate::ICMP_SLE:
3361 DstPred = ICmpInst::Predicate::ICMP_SLE;
3379 foldICmpWithTruncSignExtendedVal(ICmpInst &I,
3381 ICmpInst::Predicate SrcPred;
3403 ICmpInst::Predicate DstPred;
3405 case ICmpInst::Predicate::ICMP_EQ:
3409 DstPred = ICmpInst::Predicate::ICMP_ULT;
3411 case ICmpInst::Predicate::ICMP_NE:
3415 DstPred = ICmpInst::Predicate::ICMP_UGE;
3453 foldShiftIntoShiftInAnotherHandOfAndInICmp(ICmpInst &I, const SimplifyQuery SQ,
3531 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT,
3603 Value *InstCombiner::foldUnsignedMultiplicationOverflowCheck(ICmpInst &I) {
3604 ICmpInst::Predicate Pred;
3619 case ICmpInst::Predicate::ICMP_ULT:
3622 case ICmpInst::Predicate::ICMP_UGE:
3635 NeedNegation = Pred == ICmpInst::Predicate::ICMP_EQ;
3667 Instruction *InstCombiner::foldICmpBinOp(ICmpInst &I, const SimplifyQuery &SQ) {
3683 (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_UGE))
3683 (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_UGE))
3684 return new ICmpInst(Pred, Builder.CreateNot(Op1), X);
3687 (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_ULE))
3687 (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_ULE))
3688 return new ICmpInst(Pred, X, Builder.CreateNot(Op0));
3693 ICmpInst::isEquality(Pred) ||
3698 ICmpInst::isEquality(Pred) ||
3717 return new ICmpInst(Pred, A == Op1 ? B : A,
3723 return new ICmpInst(Pred, Constant::getNullValue(Op0->getType()),
3749 return new ICmpInst(Pred, Y, Z);
3755 return new ICmpInst(CmpInst::ICMP_SLE, A, Op1);
3760 return new ICmpInst(CmpInst::ICMP_SGT, A, Op1);
3764 return new ICmpInst(CmpInst::ICMP_SLT, A, Op1);
3768 return new ICmpInst(CmpInst::ICMP_SGE, A, Op1);
3773 return new ICmpInst(CmpInst::ICMP_SGE, Op0, C);
3778 return new ICmpInst(CmpInst::ICMP_SLT, Op0, C);
3782 return new ICmpInst(CmpInst::ICMP_SGT, Op0, C);
3786 return new ICmpInst(CmpInst::ICMP_SLE, Op0, C);
3799 return new ICmpInst(CmpInst::ICMP_ULT, A, Op1);
3803 return new ICmpInst(CmpInst::ICMP_UGE, A, Op1);
3807 return new ICmpInst(CmpInst::ICMP_UGT, Op0, C);
3811 return new ICmpInst(CmpInst::ICMP_ULE, Op0, C);
3832 return new ICmpInst(Pred, NewAdd, C);
3836 return new ICmpInst(Pred, A, NewAdd);
3858 return new ICmpInst(Pred, Constant::getNullValue(Op1->getType()), B);
3861 return new ICmpInst(Pred, D, Constant::getNullValue(Op0->getType()));
3865 if (A == Op1 && (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_ULE))
3865 if (A == Op1 && (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_ULE))
3866 return new ICmpInst(Pred, B, A);
3868 if (C == Op0 && (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_UGE))
3868 if (C == Op0 && (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_UGE))
3869 return new ICmpInst(Pred, C, D);
3871 if (A == Op1 && (Pred == ICmpInst::ICMP_UGE || Pred == ICmpInst::ICMP_ULT) &&
3871 if (A == Op1 && (Pred == ICmpInst::ICMP_UGE || Pred == ICmpInst::ICMP_ULT) &&
3873 return new ICmpInst(CmpInst::getFlippedStrictnessPredicate(Pred), B, A);
3875 if (C == Op0 && (Pred == ICmpInst::ICMP_ULE || Pred == ICmpInst::ICMP_UGT) &&
3875 if (C == Op0 && (Pred == ICmpInst::ICMP_ULE || Pred == ICmpInst::ICMP_UGT) &&
3877 return new ICmpInst(CmpInst::getFlippedStrictnessPredicate(Pred), C, D);
3881 return new ICmpInst(Pred, A, C);
3885 return new ICmpInst(Pred, D, B);
3888 if (NoOp0WrapProblem && ICmpInst::isSigned(Pred)) {
3893 return new ICmpInst(I.getSwappedPredicate(), X,
3908 switch (SRem == BO0 ? ICmpInst::getSwappedPredicate(Pred) : Pred) {
3911 case ICmpInst::ICMP_EQ:
3913 case ICmpInst::ICMP_NE:
3915 case ICmpInst::ICMP_SGT:
3916 case ICmpInst::ICMP_SGE:
3917 return new ICmpInst(ICmpInst::ICMP_SGT, SRem->getOperand(1),
3917 return new ICmpInst(ICmpInst::ICMP_SGT, SRem->getOperand(1),
3919 case ICmpInst::ICMP_SLT:
3920 case ICmpInst::ICMP_SLE:
3921 return new ICmpInst(ICmpInst::ICMP_SLT, SRem->getOperand(1),
3921 return new ICmpInst(ICmpInst::ICMP_SLT, SRem->getOperand(1),
3935 return new ICmpInst(Pred, BO0->getOperand(0), BO1->getOperand(0));
3941 ICmpInst::Predicate NewPred =
3943 return new ICmpInst(NewPred, BO0->getOperand(0), BO1->getOperand(0));
3948 ICmpInst::Predicate NewPred =
3951 return new ICmpInst(NewPred, BO0->getOperand(0), BO1->getOperand(0));
3971 return new ICmpInst(Pred, And1, And2);
3976 return new ICmpInst(Pred, BO0->getOperand(0), BO1->getOperand(0));
3984 return new ICmpInst(Pred, BO0->getOperand(0), BO1->getOperand(0));
3989 return new ICmpInst(Pred, BO0->getOperand(0), BO1->getOperand(0));
3994 return new ICmpInst(Pred, BO0->getOperand(0), BO1->getOperand(0));
4003 return new ICmpInst(Pred, BO0->getOperand(0), BO1->getOperand(0));
4013 if (match(BO0, BitwiseAnd) && Pred == ICmpInst::ICMP_ULT) {
4015 return new ICmpInst(ICmpInst::ICMP_NE, Op1, Zero);
4015 return new ICmpInst(ICmpInst::ICMP_NE, Op1, Zero);
4035 static Instruction *foldICmpWithMinMax(ICmpInst &Cmp) {
4036 ICmpInst::Predicate Pred = Cmp.getPredicate();
4054 return new ICmpInst(ICmpInst::ICMP_SLE, X, Y);
4054 return new ICmpInst(ICmpInst::ICMP_SLE, X, Y);
4059 return new ICmpInst(ICmpInst::ICMP_SGT, X, Y);
4059 return new ICmpInst(ICmpInst::ICMP_SGT, X, Y);
4071 return new ICmpInst(ICmpInst::ICMP_SGE, X, Y);
4071 return new ICmpInst(ICmpInst::ICMP_SGE, X, Y);
4076 return new ICmpInst(ICmpInst::ICMP_SLT, X, Y);
4076 return new ICmpInst(ICmpInst::ICMP_SLT, X, Y);
4088 return new ICmpInst(ICmpInst::ICMP_ULE, X, Y);
4088 return new ICmpInst(ICmpInst::ICMP_ULE, X, Y);
4093 return new ICmpInst(ICmpInst::ICMP_UGT, X, Y);
4093 return new ICmpInst(ICmpInst::ICMP_UGT, X, Y);
4105 return new ICmpInst(ICmpInst::ICMP_UGE, X, Y);
4105 return new ICmpInst(ICmpInst::ICMP_UGE, X, Y);
4110 return new ICmpInst(ICmpInst::ICMP_ULT, X, Y);
4110 return new ICmpInst(ICmpInst::ICMP_ULT, X, Y);
4121 Instruction *InstCombiner::foldICmpEquality(ICmpInst &I) {
4131 return new ICmpInst(Pred, OtherVal, Constant::getNullValue(A->getType()));
4141 return new ICmpInst(Pred, A, Xor);
4146 return new ICmpInst(Pred, B, D);
4148 return new ICmpInst(Pred, B, C);
4150 return new ICmpInst(Pred, A, D);
4152 return new ICmpInst(Pred, A, C);
4159 return new ICmpInst(Pred, OtherVal, Constant::getNullValue(A->getType()));
4204 return new ICmpInst(Pred, A, Builder.CreateTrunc(B, A->getType()));
4216 ICmpInst::Predicate NewPred =
4217 Pred == ICmpInst::ICMP_NE ? ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT;
4217 Pred == ICmpInst::ICMP_NE ? ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT;
4217 Pred == ICmpInst::ICMP_NE ? ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT;
4220 return new ICmpInst(NewPred, Xor, Builder.getInt(CmpVal));
4234 return new ICmpInst(Pred, And, Constant::getNullValue(Cst1->getType()));
4258 return new ICmpInst(Pred, Mask, Builder.getInt(CmpV));
4269 return new ICmpInst(Pred, A, B);
4290 return Pred == ICmpInst::ICMP_EQ
4291 ? new ICmpInst(ICmpInst::ICMP_ULT, CtPop, ConstantInt::get(Ty, 2))
4291 ? new ICmpInst(ICmpInst::ICMP_ULT, CtPop, ConstantInt::get(Ty, 2))
4292 : new ICmpInst(ICmpInst::ICMP_UGT, CtPop, ConstantInt::get(Ty, 1));
4292 : new ICmpInst(ICmpInst::ICMP_UGT, CtPop, ConstantInt::get(Ty, 1));
4298 static Instruction *foldICmpWithZextOrSext(ICmpInst &ICmp,
4334 return new ICmpInst(ICmp.getPredicate(), X, Y);
4339 return new ICmpInst(ICmp.getPredicate(), X, Y);
4342 return new ICmpInst(ICmp.getUnsignedPredicate(), X, Y);
4360 return new ICmpInst(ICmp.getPredicate(), X, Res1);
4365 return new ICmpInst(ICmp.getPredicate(), X, Res1);
4368 return new ICmpInst(ICmp.getUnsignedPredicate(), X, Res1);
4381 if (ICmp.getPredicate() == ICmpInst::ICMP_ULT)
4382 return new ICmpInst(CmpInst::ICMP_SGT, X, Constant::getAllOnesValue(SrcTy));
4387 return new ICmpInst(CmpInst::ICMP_SLT, X, Constant::getNullValue(SrcTy));
4391 Instruction *InstCombiner::foldICmpWithCastOp(ICmpInst &ICmp) {
4428 return new ICmpInst(ICmp.getPredicate(), Op0Src, NewOp1);
4527 static Instruction *processUMulZExtIdiom(ICmpInst &I, Value *MulVal,
4595 case ICmpInst::ICMP_EQ:
4596 case ICmpInst::ICMP_NE:
4625 case ICmpInst::ICMP_UGT:
4637 case ICmpInst::ICMP_UGE:
4648 case ICmpInst::ICMP_ULE:
4660 case ICmpInst::ICMP_ULT:
4726 case ICmpInst::ICMP_NE:
4728 case ICmpInst::ICMP_EQ:
4731 case ICmpInst::ICMP_UGT:
4732 case ICmpInst::ICMP_UGE:
4737 case ICmpInst::ICMP_ULT:
4738 case ICmpInst::ICMP_ULE:
4757 static APInt getDemandedBitsLHSMask(ICmpInst &I, unsigned BitWidth) {
4773 case ICmpInst::ICMP_UGT:
4778 case ICmpInst::ICMP_ULT:
4851 auto *IC = dyn_cast<ICmpInst>(BI->getCondition());
4851 auto *IC = dyn_cast<ICmpInst>(BI->getCondition());
4898 const ICmpInst *Icmp,
4901 if (isChainSelectCmpBranch(SI) && Icmp->getPredicate() == ICmpInst::ICMP_EQ) {
4925 Instruction *InstCombiner::foldICmpUsingKnownBits(ICmpInst &I) {
4928 ICmpInst::Predicate Pred = I.getPredicate();
4967 return new ICmpInst(Pred, ConstantExpr::getIntegerValue(Ty, Op0Min), Op1);
4969 return new ICmpInst(Pred, Op0, ConstantExpr::getIntegerValue(Ty, Op1Min));
4976 case ICmpInst::ICMP_EQ:
4977 case ICmpInst::ICMP_NE: {
5004 auto NewPred = ICmpInst::getInversePredicate(Pred);
5005 return new ICmpInst(NewPred, X, CmpC);
5012 return new ICmpInst(NewPred, X, CmpC);
5023 auto NewPred = ICmpInst::getInversePredicate(Pred);
5024 return new ICmpInst(NewPred, X, ConstantInt::get(X->getType(), CmpVal));
5029 case ICmpInst::ICMP_ULT: {
5035 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
5035 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
5041 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
5041 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
5046 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
5046 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
5051 case ICmpInst::ICMP_UGT: {
5057 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
5057 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
5063 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
5063 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
5068 return new ICmpInst(ICmpInst::ICMP_NE, Op0,
5068 return new ICmpInst(ICmpInst::ICMP_NE, Op0,
5073 case ICmpInst::ICMP_SLT: {
5079 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
5079 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
5083 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
5083 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
5088 case ICmpInst::ICMP_SGT: {
5094 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
5094 return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
5098 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
5098 return new ICmpInst(ICmpInst::ICMP_EQ, Op0,
5103 case ICmpInst::ICMP_SGE:
5110 return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
5110 return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
5112 case ICmpInst::ICMP_SLE:
5119 return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
5119 return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
5121 case ICmpInst::ICMP_UGE:
5128 return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
5128 return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
5130 case ICmpInst::ICMP_ULE:
5137 return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
5137 return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
5146 return new ICmpInst(I.getUnsignedPredicate(), Op0, Op1);
5158 bool IsSigned = ICmpInst::isSigned(Pred);
5160 CmpInst::Predicate UnsignedPred = ICmpInst::getUnsignedPredicate(Pred);
5162 UnsignedPred == ICmpInst::ICMP_ULE || UnsignedPred == ICmpInst::ICMP_UGT;
5162 UnsignedPred == ICmpInst::ICMP_ULE || UnsignedPred == ICmpInst::ICMP_UGT;
5207 static ICmpInst *canonicalizeCmpWithConstant(ICmpInst &I) {
5207 static ICmpInst *canonicalizeCmpWithConstant(ICmpInst &I) {
5208 ICmpInst::Predicate Pred = I.getPredicate();
5209 if (ICmpInst::isEquality(Pred) || !ICmpInst::isIntPredicate(Pred) ||
5209 if (ICmpInst::isEquality(Pred) || !ICmpInst::isIntPredicate(Pred) ||
5223 return new ICmpInst(FlippedStrictness->first, Op0, FlippedStrictness->second);
5227 static Instruction *canonicalizeICmpBool(ICmpInst &I,
5258 case ICmpInst::ICMP_EQ:
5262 case ICmpInst::ICMP_NE:
5266 case ICmpInst::ICMP_UGT:
5270 case ICmpInst::ICMP_ULT:
5274 case ICmpInst::ICMP_SGT:
5278 case ICmpInst::ICMP_SLT:
5282 case ICmpInst::ICMP_UGE:
5286 case ICmpInst::ICMP_ULE:
5290 case ICmpInst::ICMP_SGE:
5294 case ICmpInst::ICMP_SLE:
5306 static Instruction *foldICmpWithHighBitMask(ICmpInst &Cmp,
5308 ICmpInst::Predicate Pred, NewPred;
5317 case ICmpInst::ICMP_ULE:
5318 NewPred = ICmpInst::ICMP_NE;
5320 case ICmpInst::ICMP_UGT:
5321 NewPred = ICmpInst::ICMP_EQ;
5340 case ICmpInst::ICMP_ULT:
5341 NewPred = ICmpInst::ICMP_NE;
5343 case ICmpInst::ICMP_UGE:
5344 NewPred = ICmpInst::ICMP_EQ;
5370 Value *NewCmp = isa<ICmpInst>(Cmp) ? Builder.CreateICmp(P, V1, V2)
5377 Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
5399 if (I.getPredicate() == ICmpInst::ICMP_NE && match(Op1, m_Zero())) {
5418 if (ICmpInst *NewICmp = canonicalizeCmpWithConstant(I))
5459 ICmpInst::Predicate Pred = I.getPredicate();
5463 if (Pred == ICmpInst::ICMP_UGT && C->isMaxSignedValue()) {
5465 return new ICmpInst(ICmpInst::ICMP_SLT, Op0, Zero);
5465 return new ICmpInst(ICmpInst::ICMP_SLT, Op0, Zero);
5469 if (Pred == ICmpInst::ICMP_ULT && C->isMinSignedValue()) {
5471 return new ICmpInst(ICmpInst::ICMP_SGT, Op0, AllOnes);
5471 return new ICmpInst(ICmpInst::ICMP_SGT, Op0, AllOnes);
5492 ICmpInst::getSwappedPredicate(I.getPredicate()), I))
5523 return new ICmpInst(I.getInversePredicate(), Builder.CreateAnd(A, B),
5530 return new ICmpInst(I.getPredicate(), B, A);
5534 return new ICmpInst(I.getSwappedPredicate(), A,
5574 if (I.getPredicate() == ICmpInst::ICMP_EQ)
5673 ICmpInst::Predicate Pred;
5678 Pred = ICmpInst::ICMP_EQ;
5682 Pred = LHSUnsigned ? ICmpInst::ICMP_UGT : ICmpInst::ICMP_SGT;
5682 Pred = LHSUnsigned ? ICmpInst::ICMP_UGT : ICmpInst::ICMP_SGT;
5686 Pred = LHSUnsigned ? ICmpInst::ICMP_UGE : ICmpInst::ICMP_SGE;
5686 Pred = LHSUnsigned ? ICmpInst::ICMP_UGE : ICmpInst::ICMP_SGE;
5690 Pred = LHSUnsigned ? ICmpInst::ICMP_ULT : ICmpInst::ICMP_SLT;
5690 Pred = LHSUnsigned ? ICmpInst::ICMP_ULT : ICmpInst::ICMP_SLT;
5694 Pred = LHSUnsigned ? ICmpInst::ICMP_ULE : ICmpInst::ICMP_SLE;
5694 Pred = LHSUnsigned ? ICmpInst::ICMP_ULE : ICmpInst::ICMP_SLE;
5698 Pred = ICmpInst::ICMP_NE;
5719 if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SLT ||
5719 if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SLT ||
5720 Pred == ICmpInst::ICMP_SLE)
5731 if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_ULT ||
5731 if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_ULT ||
5732 Pred == ICmpInst::ICMP_ULE)
5744 if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SGT ||
5744 if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SGT ||
5745 Pred == ICmpInst::ICMP_SGE)
5755 if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_UGT ||
5755 if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_UGT ||
5756 Pred == ICmpInst::ICMP_UGE)
5779 case ICmpInst::ICMP_NE: // (float)int != 4.4 --> true
5781 case ICmpInst::ICMP_EQ: // (float)int == 4.4 --> false
5783 case ICmpInst::ICMP_ULE:
5789 case ICmpInst::ICMP_SLE:
5793 Pred = ICmpInst::ICMP_SLT;
5795 case ICmpInst::ICMP_ULT:
5800 Pred = ICmpInst::ICMP_ULE;
5802 case ICmpInst::ICMP_SLT:
5806 Pred = ICmpInst::ICMP_SLE;
5808 case ICmpInst::ICMP_UGT:
5814 case ICmpInst::ICMP_SGT:
5818 Pred = ICmpInst::ICMP_SGE;
5820 case ICmpInst::ICMP_UGE:
5825 Pred = ICmpInst::ICMP_UGT;
5827 case ICmpInst::ICMP_SGE:
5831 Pred = ICmpInst::ICMP_SGT;
5839 return new ICmpInst(Pred, LHSI->getOperand(0), RHSInt);
lib/Transforms/InstCombine/InstCombineInternal.h 119 inline bool isSignBitCheck(ICmpInst::Predicate Pred, const APInt &RHS,
122 case ICmpInst::ICMP_SLT: // True if LHS s< 0
125 case ICmpInst::ICMP_SLE: // True if LHS s<= -1
128 case ICmpInst::ICMP_SGT: // True if LHS s> -1
131 case ICmpInst::ICMP_SGE: // True if LHS s>= 0
134 case ICmpInst::ICMP_UGT:
138 case ICmpInst::ICMP_UGE:
142 case ICmpInst::ICMP_ULT:
146 case ICmpInst::ICMP_ULE:
388 Value *simplifyRangeCheck(ICmpInst *Cmp0, ICmpInst *Cmp1, bool Inverted);
388 Value *simplifyRangeCheck(ICmpInst *Cmp0, ICmpInst *Cmp1, bool Inverted);
404 Instruction *visitICmpInst(ICmpInst &I);
460 bool replacedSelectWithOperand(SelectInst *SI, const ICmpInst *Icmp,
526 Instruction *transformZExtICmp(ICmpInst *ICI, ZExtInst &CI,
529 Instruction *transformSExtICmp(ICmpInst *ICI, Instruction &CI);
619 Value *foldAndOfICmps(ICmpInst *LHS, ICmpInst *RHS, Instruction &CxtI);
619 Value *foldAndOfICmps(ICmpInst *LHS, ICmpInst *RHS, Instruction &CxtI);
620 Value *foldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS, Instruction &CxtI);
620 Value *foldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS, Instruction &CxtI);
621 Value *foldXorOfICmps(ICmpInst *LHS, ICmpInst *RHS, BinaryOperator &I);
621 Value *foldXorOfICmps(ICmpInst *LHS, ICmpInst *RHS, BinaryOperator &I);
628 Value *foldAndOrOfICmpsOfAndWithPow2(ICmpInst *LHS, ICmpInst *RHS,
628 Value *foldAndOrOfICmpsOfAndWithPow2(ICmpInst *LHS, ICmpInst *RHS,
902 ICmpInst::Predicate Cond, Instruction &I);
903 Instruction *foldAllocaCmp(ICmpInst &ICI, const AllocaInst *Alloca,
911 ICmpInst::Predicate Pred);
912 Instruction *foldICmpWithCastOp(ICmpInst &ICI);
914 Instruction *foldICmpUsingKnownBits(ICmpInst &Cmp);
915 Instruction *foldICmpWithDominatingICmp(ICmpInst &Cmp);
916 Instruction *foldICmpWithConstant(ICmpInst &Cmp);
917 Instruction *foldICmpInstWithConstant(ICmpInst &Cmp);
918 Instruction *foldICmpInstWithConstantNotInt(ICmpInst &Cmp);
919 Instruction *foldICmpBinOp(ICmpInst &Cmp, const SimplifyQuery &SQ);
920 Instruction *foldICmpEquality(ICmpInst &Cmp);
921 Instruction *foldIRemByPowerOfTwoToBitTest(ICmpInst &I);
922 Instruction *foldSignBitTest(ICmpInst &I);
923 Instruction *foldICmpWithZero(ICmpInst &Cmp);
925 Value *foldUnsignedMultiplicationOverflowCheck(ICmpInst &Cmp);
927 Instruction *foldICmpSelectConstant(ICmpInst &Cmp, SelectInst *Select,
929 Instruction *foldICmpTruncConstant(ICmpInst &Cmp, TruncInst *Trunc,
931 Instruction *foldICmpAndConstant(ICmpInst &Cmp, BinaryOperator *And,
933 Instruction *foldICmpXorConstant(ICmpInst &Cmp, BinaryOperator *Xor,
935 Instruction *foldICmpOrConstant(ICmpInst &Cmp, BinaryOperator *Or,
937 Instruction *foldICmpMulConstant(ICmpInst &Cmp, BinaryOperator *Mul,
939 Instruction *foldICmpShlConstant(ICmpInst &Cmp, BinaryOperator *Shl,
941 Instruction *foldICmpShrConstant(ICmpInst &Cmp, BinaryOperator *Shr,
943 Instruction *foldICmpSRemConstant(ICmpInst &Cmp, BinaryOperator *UDiv,
945 Instruction *foldICmpUDivConstant(ICmpInst &Cmp, BinaryOperator *UDiv,
947 Instruction *foldICmpDivConstant(ICmpInst &Cmp, BinaryOperator *Div,
949 Instruction *foldICmpSubConstant(ICmpInst &Cmp, BinaryOperator *Sub,
951 Instruction *foldICmpAddConstant(ICmpInst &Cmp, BinaryOperator *Add,
953 Instruction *foldICmpAndConstConst(ICmpInst &Cmp, BinaryOperator *And,
955 Instruction *foldICmpAndShift(ICmpInst &Cmp, BinaryOperator *And,
957 Instruction *foldICmpShrConstConst(ICmpInst &I, Value *ShAmt, const APInt &C1,
959 Instruction *foldICmpShlConstConst(ICmpInst &I, Value *ShAmt, const APInt &C1,
962 Instruction *foldICmpBinOpEqualityWithConstant(ICmpInst &Cmp,
965 Instruction *foldICmpIntrinsicWithConstant(ICmpInst &ICI, IntrinsicInst *II,
967 Instruction *foldICmpEqIntrinsicWithConstant(ICmpInst &ICI, IntrinsicInst *II,
977 Instruction *foldSelectInstWithICmp(SelectInst &SI, ICmpInst *ICI);
lib/Transforms/InstCombine/InstCombinePHI.cpp 1180 auto *CmpInst = dyn_cast<ICmpInst>(PHIUser);
1180 auto *CmpInst = dyn_cast<ICmpInst>(PHIUser);
lib/Transforms/InstCombine/InstCombineSelect.cpp 68 if (ICmpInst::isEquality(Pred))
69 IsEq = Pred == ICmpInst::ICMP_EQ;
123 static Value *foldSelectICmpAnd(SelectInst &Sel, ICmpInst *Cmp,
138 ICmpInst::Predicate Pred = Cmp->getPredicate();
139 if (ICmpInst::isEquality(Pred)) {
180 if (Pred == ICmpInst::ICMP_EQ) {
187 if (Pred == ICmpInst::ICMP_NE) {
226 ShouldNotVal ^= Pred == ICmpInst::ICMP_NE;
501 static Instruction *foldSelectICmpAndAnd(Type *SelType, const ICmpInst *Cmp,
505 Cmp->getPredicate() == ICmpInst::ICMP_EQ &&
539 static Value *foldSelectICmpLshrAshr(const ICmpInst *IC, Value *TrueVal,
542 ICmpInst::Predicate Pred = IC->getPredicate();
550 if ((Pred != ICmpInst::ICMP_SGT ||
552 m_SpecificInt_ICMP(ICmpInst::ICMP_SGE, APInt(Bitwidth, -1)))) &&
553 (Pred != ICmpInst::ICMP_SLT ||
555 m_SpecificInt_ICMP(ICmpInst::ICMP_SGE, APInt(Bitwidth, 0)))))
559 if (Pred == ICmpInst::ICMP_SLT)
587 static Value *foldSelectICmpAndOr(const ICmpInst *IC, Value *TrueVal,
613 IsEqualZero = IC->getPredicate() == ICmpInst::ICMP_EQ;
614 } else if (IC->getPredicate() == ICmpInst::ICMP_SLT ||
615 IC->getPredicate() == ICmpInst::ICMP_SGT) {
618 IsEqualZero = IC->getPredicate() == ICmpInst::ICMP_SGT;
680 static Value *canonicalizeSaturatedSubtract(const ICmpInst *ICI,
684 ICmpInst::Predicate Pred = ICI->getPredicate();
685 if (!ICmpInst::isUnsigned(Pred))
690 Pred = ICmpInst::getInversePredicate(Pred);
698 if (Pred == ICmpInst::ICMP_ULE || Pred == ICmpInst::ICMP_ULT) {
698 if (Pred == ICmpInst::ICMP_ULE || Pred == ICmpInst::ICMP_ULT) {
701 Pred = ICmpInst::getSwappedPredicate(Pred);
727 static Value *canonicalizeSaturatedAdd(ICmpInst *Cmp, Value *TVal, Value *FVal,
735 ICmpInst::Predicate Pred = Cmp->getPredicate();
738 if (Pred == ICmpInst::ICMP_ULT &&
759 if (Pred == ICmpInst::ICMP_UGT) {
760 Pred = ICmpInst::ICMP_ULT;
763 if (Pred != ICmpInst::ICMP_ULT)
803 static Instruction *foldSelectCtlzToCttz(ICmpInst *ICI, Value *TrueVal,
810 if (ICI->getPredicate() == ICmpInst::ICMP_NE)
842 static Value *foldSelectCttzCtlz(ICmpInst *ICI, Value *TrueVal, Value *FalseVal,
844 ICmpInst::Predicate Pred = ICI->getPredicate();
854 if (Pred == ICmpInst::ICMP_NE)
894 static bool adjustMinMax(SelectInst &Sel, ICmpInst &Cmp) {
895 ICmpInst::Predicate Pred = Cmp.getPredicate();
914 if (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_SGT)
914 if (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_SGT)
916 else if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_SLT)
916 else if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_SLT)
967 Pred = ICmpInst::getSwappedPredicate(Pred);
991 canonicalizeMinMaxWithConstant(SelectInst &Sel, ICmpInst &Cmp,
1003 ICmpInst::Predicate CanonicalPred = getMinMaxPred(SPR.Flavor);
1029 static Instruction *canonicalizeAbsNabs(SelectInst &Sel, ICmpInst &Cmp,
1055 Cmp.getPredicate() == ICmpInst::ICMP_SLT;
1069 Cmp.setPredicate(ICmpInst::ICMP_SLT);
1137 static Value *foldSelectValueEquivalence(SelectInst &Sel, ICmpInst &Cmp,
1144 if (Cmp.getPredicate() == ICmpInst::ICMP_NE)
1178 static Instruction *canonicalizeClampLike(SelectInst &Sel0, ICmpInst &Cmp0,
1195 case ICmpInst::Predicate::ICMP_ULT:
1197 case ICmpInst::Predicate::ICMP_ULE:
1202 case ICmpInst::Predicate::ICMP_UGT:
1206 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_NE,
1213 case ICmpInst::Predicate::ICMP_UGE:
1237 ICmpInst::Predicate Pred1;
1255 case ICmpInst::Predicate::ICMP_SLT:
1257 case ICmpInst::Predicate::ICMP_SLE:
1262 case ICmpInst::Predicate::ICMP_SGT:
1266 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_NE,
1272 case ICmpInst::Predicate::ICMP_SGE:
1286 auto *Precond1 = ConstantExpr::getICmp(ICmpInst::Predicate::ICMP_SGE, C2,
1291 auto *Precond2 = ConstantExpr::getICmp(ICmpInst::Predicate::ICMP_SLE, C2,
1316 tryToReuseConstantFromSelectInComparison(SelectInst &Sel, ICmpInst &Cmp,
1318 ICmpInst::Predicate Pred;
1327 if (ICmpInst::isEquality(Pred))
1372 Pred = ICmpInst::getSwappedPredicate(Pred); // Yes, swapped.
1384 ICmpInst *ICI) {
1409 ICmpInst::Predicate Pred = ICI->getPredicate();
1413 if (CmpLHS == TrueVal && Pred == ICmpInst::ICMP_EQ) {
1417 } else if (CmpLHS == FalseVal && Pred == ICmpInst::ICMP_NE) {
1434 if (ICmpInst::isEquality(Pred) &&
1438 TrueWhenUnset = Pred == ICmpInst::ICMP_EQ;
1439 } else if (Pred == ICmpInst::ICMP_SLT && match(CmpRHS, m_Zero())) {
1444 } else if (Pred == ICmpInst::ICMP_SGT && match(CmpRHS, m_AllOnes())) {
2176 ICmpInst::Predicate Pred;
2178 Pred != ICmpInst::ICMP_EQ)
2203 ICmpInst *CI = dyn_cast<ICmpInst>(U);
2203 ICmpInst *CI = dyn_cast<ICmpInst>(U);
2395 if (ICmpInst *ICI = dyn_cast<ICmpInst>(CondVal))
2395 if (ICmpInst *ICI = dyn_cast<ICmpInst>(CondVal))
lib/Transforms/InstCombine/InstCombineShifts.cpp 91 if (!match(NewShAmt, m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT,
103 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ,
1105 C, m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ,
lib/Transforms/InstCombine/InstCombineVectorOps.cpp 1253 return new ICmpInst(I, cast<ICmpInst>(I)->getPredicate(),
1253 return new ICmpInst(I, cast<ICmpInst>(I)->getPredicate(),
lib/Transforms/InstCombine/InstructionCombining.cpp 1037 else if (isa<ICmpInst>(CI))
2295 ICmpInst *ICI = cast<ICmpInst>(I);
2295 ICmpInst *ICI = cast<ICmpInst>(I);
2400 if (ICmpInst *C = dyn_cast<ICmpInst>(I)) {
2400 if (ICmpInst *C = dyn_cast<ICmpInst>(I)) {
2481 ICmpInst::Predicate Pred;
2488 if (Pred != ICmpInst::ICMP_EQ && Pred != ICmpInst::ICMP_NE)
2488 if (Pred != ICmpInst::ICMP_EQ && Pred != ICmpInst::ICMP_NE)
2492 if (SuccBB != (Pred == ICmpInst::ICMP_EQ ? TrueBB : FalseBB))
2725 return new ICmpInst(ICmpInst::ICMP_UGT, WO->getLHS(),
2725 return new ICmpInst(ICmpInst::ICMP_UGT, WO->getLHS(),
lib/Transforms/Instrumentation/AddressSanitizer.cpp 1445 if (ICmpInst *Cmp = dyn_cast<ICmpInst>(I)) {
1445 if (ICmpInst *Cmp = dyn_cast<ICmpInst>(I)) {
1482 FunctionCallee F = isa<ICmpInst>(I) ? AsanPtrCmpFunction : AsanPtrSubFunction;
lib/Transforms/Instrumentation/ControlHeightReduction.cpp 1523 static bool negateICmpIfUsedByBranchOrSelectOnly(ICmpInst *ICmp,
1963 if (auto *ICmp = dyn_cast<ICmpInst>(Cond))
1963 if (auto *ICmp = dyn_cast<ICmpInst>(Cond))
lib/Transforms/Instrumentation/MemorySanitizer.cpp 2210 void handleEqualityComparison(ICmpInst &I) {
2283 void handleRelationalComparisonExact(ICmpInst &I) {
2315 void handleSignedRelationalComparison(ICmpInst &I) {
2344 void visitICmpInst(ICmpInst &I) {
lib/Transforms/Instrumentation/PGOInstrumentation.cpp 266 ICmpInst *CI = dyn_cast<ICmpInst>(Cond);
266 ICmpInst *CI = dyn_cast<ICmpInst>(Cond);
lib/Transforms/Instrumentation/PoisonChecking.cpp 157 B.CreateICmp(ICmpInst::ICMP_NE, B.CreateURem(LHS, RHS),
166 B.CreateICmp(ICmpInst::ICMP_NE, B.CreateSRem(LHS, RHS),
176 B.CreateICmp(ICmpInst::ICMP_UGE, RHS,
202 B.CreateICmp(ICmpInst::ICMP_UGE, Idx,
214 B.CreateICmp(ICmpInst::ICMP_UGE, Idx,
lib/Transforms/Instrumentation/SanitizerCoverage.cpp 556 static bool IsInterestingCmp(ICmpInst *CMP, const DominatorTree *DT,
614 if (ICmpInst *CMP = dyn_cast<ICmpInst>(&Inst))
614 if (ICmpInst *CMP = dyn_cast<ICmpInst>(&Inst))
815 if (ICmpInst *ICMP = dyn_cast<ICmpInst>(I)) {
815 if (ICmpInst *ICMP = dyn_cast<ICmpInst>(I)) {
lib/Transforms/ObjCARC/DependencyAnalysis.cpp 92 if (const ICmpInst *ICI = dyn_cast<ICmpInst>(Inst)) {
92 if (const ICmpInst *ICI = dyn_cast<ICmpInst>(Inst)) {
lib/Transforms/Scalar/AlignmentFromAssumptions.cpp 203 ICmpInst *ICI = dyn_cast<ICmpInst>(I->getArgOperand(0));
203 ICmpInst *ICI = dyn_cast<ICmpInst>(I->getArgOperand(0));
208 if (ICI->getPredicate() != ICmpInst::ICMP_EQ)
lib/Transforms/Scalar/CallSiteSplitting.cpp 109 static bool isCondRelevantToAnyCallArgument(ICmpInst *Cmp, CallSite CS) {
125 typedef std::pair<ICmpInst *, unsigned> ConditionTy;
141 ICmpInst *Cmp = cast<ICmpInst>(Cond);
141 ICmpInst *Cmp = cast<ICmpInst>(Cond);
142 if (Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_NE)
142 if (Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_NE)
170 if (Cond.second == ICmpInst::ICMP_EQ)
lib/Transforms/Scalar/CorrelatedValuePropagation.cpp 252 if (LVI->getPredicateOnEdge(ICmpInst::ICMP_EQ, SI, C,
586 LVI->getPredicateAt(ICmpInst::ICMP_EQ, V,
610 auto Result = LVI->getPredicateAt(ICmpInst::ICMP_SGE, O, Zero, SDI);
704 if (LVI->getPredicateAt(ICmpInst::ICMP_SGE, SDI->getOperand(0), Zero, SDI) !=
726 if (LVI->getPredicateAt(ICmpInst::ICMP_SGE, Base, Zero, SDI) !=
lib/Transforms/Scalar/EarlyCSE.cpp 157 if (auto *CmpI = dyn_cast<ICmpInst>(Cond))
157 if (auto *CmpI = dyn_cast<ICmpInst>(Cond))
lib/Transforms/Scalar/GuardWidening.cpp 211 ICmpInst *CheckInst;
215 const Value *Length, ICmpInst *CheckInst)
225 ICmpInst *getCheckInst() const { return CheckInst; }
542 ICmpInst::Predicate Pred0, Pred1;
546 Pred1 = ICmpInst::getInversePredicate(Pred1);
571 Result = new ICmpInst(InsertPt, Pred, LHS, NewRHS, "wide.chk");
630 auto *IC = dyn_cast<ICmpInst>(CheckCond);
630 auto *IC = dyn_cast<ICmpInst>(CheckCond);
632 (IC->getPredicate() != ICmpInst::ICMP_ULT &&
633 IC->getPredicate() != ICmpInst::ICMP_UGT))
637 if (IC->getPredicate() == ICmpInst::ICMP_UGT)
lib/Transforms/Scalar/IndVarSimplify.cpp 467 ICmpInst *NewCompare = new ICmpInst(TheBr, NewPred, NewAdd,
467 ICmpInst *NewCompare = new ICmpInst(TheBr, NewPred, NewAdd,
1359 ICmpInst *Cmp = dyn_cast<ICmpInst>(DU.NarrowUse);
1359 ICmpInst *Cmp = dyn_cast<ICmpInst>(DU.NarrowUse);
1696 SE->isKnownPredicate(ICmpInst::ICMP_SGE, NarrowSCEV,
2060 ICmpInst *ICmp = dyn_cast<ICmpInst>(BI->getCondition());
2060 ICmpInst *ICmp = dyn_cast<ICmpInst>(BI->getCondition());
2083 ICmpInst *Cond = dyn_cast<ICmpInst>(BI->getCondition());
2083 ICmpInst *Cond = dyn_cast<ICmpInst>(BI->getCondition());
2088 ICmpInst::Predicate Pred = Cond->getPredicate();
2089 if (Pred != ICmpInst::ICMP_NE && Pred != ICmpInst::ICMP_EQ)
2089 if (Pred != ICmpInst::ICMP_NE && Pred != ICmpInst::ICMP_EQ)
2480 ICmpInst::Predicate P;
2482 P = ICmpInst::ICMP_NE;
2484 P = ICmpInst::ICMP_EQ;
2958 ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ;
2958 ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ;
lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp 147 static bool parseRangeCheckICmp(Loop *L, ICmpInst *ICI, ScalarEvolution &SE,
201 return SE.isKnownPredicate(ICmpInst::ICMP_SGE, Begin, End);
203 return SE.isKnownPredicate(ICmpInst::ICMP_UGE, Begin, End);
276 InductiveRangeCheck::parseRangeCheckICmp(Loop *L, ICmpInst *ICI,
283 ICmpInst::Predicate Pred = ICI->getPredicate();
291 case ICmpInst::ICMP_SLE:
294 case ICmpInst::ICMP_SGE:
302 case ICmpInst::ICMP_SLT:
305 case ICmpInst::ICMP_SGT:
319 case ICmpInst::ICMP_ULT:
322 case ICmpInst::ICMP_UGT:
352 ICmpInst *ICI = dyn_cast<ICmpInst>(Condition);
352 ICmpInst *ICI = dyn_cast<ICmpInst>(Condition);
644 ICmpInst::Predicate Pred,
647 if (Pred != ICmpInst::ICMP_SLT && Pred != ICmpInst::ICMP_SGT &&
647 if (Pred != ICmpInst::ICMP_SLT && Pred != ICmpInst::ICMP_SGT &&
648 Pred != ICmpInst::ICMP_ULT && Pred != ICmpInst::ICMP_UGT)
648 Pred != ICmpInst::ICMP_ULT && Pred != ICmpInst::ICMP_UGT)
664 bool IsSigned = ICmpInst::isSigned(Pred);
667 ICmpInst::Predicate BoundPred =
694 ICmpInst::Predicate Pred,
697 if (Pred != ICmpInst::ICMP_SLT && Pred != ICmpInst::ICMP_SGT &&
697 if (Pred != ICmpInst::ICMP_SLT && Pred != ICmpInst::ICMP_SGT &&
698 Pred != ICmpInst::ICMP_ULT && Pred != ICmpInst::ICMP_UGT)
698 Pred != ICmpInst::ICMP_ULT && Pred != ICmpInst::ICMP_UGT)
712 bool IsSigned = ICmpInst::isSigned(Pred);
715 ICmpInst::Predicate BoundPred =
782 ICmpInst *ICI = dyn_cast<ICmpInst>(LatchBr->getCondition());
782 ICmpInst *ICI = dyn_cast<ICmpInst>(LatchBr->getCondition());
794 ICmpInst::Predicate Pred = ICI->getPredicate();
807 Pred = ICmpInst::getSwappedPredicate(Pred);
873 if (Pred == ICmpInst::ICMP_NE && LatchBrExitIdx == 1)
882 Pred = ICmpInst::ICMP_ULT;
884 Pred = ICmpInst::ICMP_SLT;
885 else if (Pred == ICmpInst::ICMP_EQ && LatchBrExitIdx == 0) {
893 Pred = ICmpInst::ICMP_UGT;
898 Pred = ICmpInst::ICMP_SGT;
906 bool LTPred = (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_ULT);
906 bool LTPred = (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_ULT);
907 bool GTPred = (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_UGT);
907 bool GTPred = (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_UGT);
916 IsSignedPredicate = ICmpInst::isSigned(Pred);
942 if (Pred == ICmpInst::ICMP_NE && LatchBrExitIdx == 1)
949 Pred = ICmpInst::ICMP_SGT;
950 else if (Pred == ICmpInst::ICMP_EQ && LatchBrExitIdx == 0) {
958 Pred = ICmpInst::ICMP_ULT;
962 Pred = ICmpInst::ICMP_SLT;
969 bool LTPred = (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_ULT);
969 bool LTPred = (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_ULT);
970 bool GTPred = (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_UGT);
970 bool GTPred = (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_UGT);
981 Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SGT;
981 Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SGT;
1110 ICmpInst::Predicate PredLE =
1111 IsSignedPredicate ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE;
1111 IsSignedPredicate ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE;
1112 ICmpInst::Predicate PredLT =
1113 IsSignedPredicate ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
1113 IsSignedPredicate ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
1277 ? (IsSignedPredicate ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT)
1277 ? (IsSignedPredicate ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT)
1278 : (IsSignedPredicate ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT);
1278 : (IsSignedPredicate ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT);
lib/Transforms/Scalar/InferAddressSpaces.cpp 377 else if (ICmpInst *Cmp = dyn_cast<ICmpInst>(&I)) {
377 else if (ICmpInst *Cmp = dyn_cast<ICmpInst>(&I)) {
955 if (ICmpInst *Cmp = dyn_cast<ICmpInst>(CurUser)) {
955 if (ICmpInst *Cmp = dyn_cast<ICmpInst>(CurUser)) {
lib/Transforms/Scalar/JumpThreading.cpp 2585 if (ICmpInst *Cmp = dyn_cast<ICmpInst>(U.getUser())) {
2585 if (ICmpInst *Cmp = dyn_cast<ICmpInst>(U.getUser())) {
lib/Transforms/Scalar/LoopFuse.cpp 916 ICmpInst::Predicate Pred =
917 EqualIsInvalid ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_SGE;
917 EqualIsInvalid ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_SGE;
lib/Transforms/Scalar/LoopIdiomRecognize.cpp 226 ICmpInst::Predicate BCmpPred;
236 bool detectBCmpIdiom(ICmpInst *&BCmpInst, CmpInst *&LatchCmpInst,
239 BasicBlock *transformBCmpControlFlow(ICmpInst *ComparedEqual);
240 void transformLoopToBCmp(ICmpInst *BCmpInst, CmpInst *LatchCmpInst,
920 CurLoop, ICmpInst::ICMP_NE, BECount,
1228 ICmpInst *Cond = dyn_cast<ICmpInst>(BI->getCondition());
1228 ICmpInst *Cond = dyn_cast<ICmpInst>(BI->getCondition());
1241 ICmpInst::Predicate Pred = Cond->getPredicate();
1242 if ((Pred == ICmpInst::ICMP_NE && TrueSucc == LoopEntry) ||
1243 (Pred == ICmpInst::ICMP_EQ && FalseSucc == LoopEntry))
1752 ICmpInst *LbCond = cast<ICmpInst>(LbBr->getCondition());
1752 ICmpInst *LbCond = cast<ICmpInst>(LbBr->getCondition());
1822 ICmpInst *PreCond = cast<ICmpInst>(PreCondBr->getCondition());
1822 ICmpInst *PreCond = cast<ICmpInst>(PreCondBr->getCondition());
1829 ICmpInst *NewPreCond = cast<ICmpInst>(
1829 ICmpInst *NewPreCond = cast<ICmpInst>(
1859 ICmpInst *LbCond = cast<ICmpInst>(LbBr->getCondition());
1859 ICmpInst *LbCond = cast<ICmpInst>(LbBr->getCondition());
1891 ICmpInst::Predicate BCmpPred;
1947 !ICmpInst::isEquality(CmpOfLoads.BCmpPred)) {
1965 if (CmpOfLoads.BCmpPred != ICmpInst::Predicate::ICMP_EQ)
2125 bool LoopIdiomRecognize::detectBCmpIdiom(ICmpInst *&BCmpInst,
2150 BCmpInst = cast<ICmpInst>(CmpLoop.BCmpValue); // FIXME: is there no
2227 LoopIdiomRecognize::transformBCmpControlFlow(ICmpInst *ComparedEqual) {
2591 void LoopIdiomRecognize::transformLoopToBCmp(ICmpInst *BCmpInst,
2656 auto *ComparedEqual = cast<ICmpInst>(Builder.CreateICmpEQ(
2656 auto *ComparedEqual = cast<ICmpInst>(Builder.CreateICmpEQ(
2683 ICmpInst *BCmpInst;
lib/Transforms/Scalar/LoopPredication.cpp 236 ICmpInst::Predicate Pred;
239 LoopICmp(ICmpInst::Predicate Pred, const SCEVAddRecExpr *IV,
260 Optional<LoopICmp> parseLoopICmp(ICmpInst *ICI);
280 ICmpInst::Predicate Pred, const SCEV *LHS,
283 Optional<Value *> widenICmpRangeCheck(ICmpInst *ICI, SCEVExpander &Expander,
363 LoopPredication::parseLoopICmp(ICmpInst *ICI) {
379 Pred = ICmpInst::getSwappedPredicate(Pred);
391 ICmpInst::Predicate Pred, const SCEV *LHS,
400 if (SE->isLoopEntryGuardedByCond(L, ICmpInst::getInversePredicate(Pred),
586 ICmpInst::getFlippedStrictnessPredicate(LatchCheck.Pred);
638 ICmpInst::getFlippedStrictnessPredicate(LatchCheck.Pred);
640 ICmpInst::ICMP_ULT,
652 if (ICmpInst::isEquality(RC.Pred) &&
654 SE->isKnownPredicate(ICmpInst::ICMP_ULE, RC.IV->getStart(), RC.Limit))
655 RC.Pred = RC.Pred == ICmpInst::ICMP_NE ?
656 ICmpInst::ICMP_ULT : ICmpInst::ICMP_UGE;
656 ICmpInst::ICMP_ULT : ICmpInst::ICMP_UGE;
663 Optional<Value *> LoopPredication::widenICmpRangeCheck(ICmpInst *ICI,
680 if (RangeCheck->Pred != ICmpInst::ICMP_ULT) {
760 if (ICmpInst *ICI = dyn_cast<ICmpInst>(Condition)) {
760 if (ICmpInst *ICI = dyn_cast<ICmpInst>(Condition)) {
853 auto *ICI = dyn_cast<ICmpInst>(BI->getCondition());
853 auto *ICI = dyn_cast<ICmpInst>(BI->getCondition());
865 Result->Pred = ICmpInst::getInversePredicate(Result->Pred);
882 return Pred != ICmpInst::ICMP_ULT && Pred != ICmpInst::ICMP_SLT &&
882 return Pred != ICmpInst::ICMP_ULT && Pred != ICmpInst::ICMP_SLT &&
883 Pred != ICmpInst::ICMP_ULE && Pred != ICmpInst::ICMP_SLE;
883 Pred != ICmpInst::ICMP_ULE && Pred != ICmpInst::ICMP_SLE;
886 return Pred != ICmpInst::ICMP_UGT && Pred != ICmpInst::ICMP_SGT &&
886 return Pred != ICmpInst::ICMP_UGT && Pred != ICmpInst::ICMP_SGT &&
887 Pred != ICmpInst::ICMP_UGE && Pred != ICmpInst::ICMP_SGE;
887 Pred != ICmpInst::ICMP_UGE && Pred != ICmpInst::ICMP_SGE;
lib/Transforms/Scalar/LoopRerollPass.cpp 1471 new ICmpInst(BI, CmpInst::ICMP_EQ, NewIV, TakenCount, "exitcond");
lib/Transforms/Scalar/LoopStrengthReduce.cpp 1956 bool FindIVUserForCond(ICmpInst *Cond, IVStrideUse *&CondUse);
1957 ICmpInst *OptimizeMax(ICmpInst *Cond, IVStrideUse* &CondUse);
1957 ICmpInst *OptimizeMax(ICmpInst *Cond, IVStrideUse* &CondUse);
2187 bool LSRInstance::FindIVUserForCond(ICmpInst *Cond, IVStrideUse *&CondUse) {
2247 ICmpInst *LSRInstance::OptimizeMax(ICmpInst *Cond, IVStrideUse* &CondUse) {
2247 ICmpInst *LSRInstance::OptimizeMax(ICmpInst *Cond, IVStrideUse* &CondUse) {
2268 CmpInst::Predicate Pred = ICmpInst::BAD_ICMP_PREDICATE;
2271 Pred = ICmpInst::ICMP_SLE;
2274 Pred = ICmpInst::ICMP_SLT;
2277 Pred = ICmpInst::ICMP_ULT;
2295 (ICmpInst::isTrueWhenEqual(Pred) ? !MaxLHS->isZero() : (MaxLHS != One)))
2313 if (ICmpInst::isTrueWhenEqual(Pred)) {
2342 ICmpInst *NewCond =
2343 new ICmpInst(Cond, Pred, Cond->getOperand(0), NewRHS, "scmp");
2395 if (TermBr->isUnconditional() || !isa<ICmpInst>(TermBr->getCondition()))
2400 ICmpInst *Cond = cast<ICmpInst>(TermBr->getCondition());
2400 ICmpInst *Cond = cast<ICmpInst>(TermBr->getCondition());
2480 ICmpInst *OldCond = Cond;
2481 Cond = cast<ICmpInst>(Cond->clone());
3271 if (ICmpInst *CI = dyn_cast<ICmpInst>(UserInst)) {
3271 if (ICmpInst *CI = dyn_cast<ICmpInst>(UserInst)) {
3274 if (SaveCmp && CI == dyn_cast<ICmpInst>(ExitBranch->getCondition()))
3451 if (const ICmpInst *ICI = dyn_cast<ICmpInst>(UserInst)) {
3451 if (const ICmpInst *ICI = dyn_cast<ICmpInst>(UserInst)) {
5075 dyn_cast<Instruction>(cast<ICmpInst>(LF.UserInst)->getOperand(1)))
5269 ICmpInst *CI = cast<ICmpInst>(LF.UserInst);
5269 ICmpInst *CI = cast<ICmpInst>(LF.UserInst);
lib/Transforms/Scalar/LoopUnswitch.cpp 594 ICmpInst *CI = dyn_cast<ICmpInst>(&LoopCond);
594 ICmpInst *CI = dyn_cast<ICmpInst>(&LoopCond);
945 BranchVal = new ICmpInst(OldBranch, ICmpInst::ICMP_EQ, LIC, Val);
945 BranchVal = new ICmpInst(OldBranch, ICmpInst::ICMP_EQ, LIC, Val);
1658 ICmpInst *CI = dyn_cast<ICmpInst>(Inst);
1658 ICmpInst *CI = dyn_cast<ICmpInst>(Inst);
lib/Transforms/Scalar/LowerExpectIntrinsic.cpp 251 ICmpInst *CmpI = dyn_cast<ICmpInst>(BSI.getCondition());
251 ICmpInst *CmpI = dyn_cast<ICmpInst>(BSI.getCondition());
lib/Transforms/Scalar/MergeICmps.cpp 235 ICmpInst *CmpI = nullptr;
322 BCECmpBlock visitICmp(const ICmpInst *const CmpI,
323 const ICmpInst::Predicate ExpectedPredicate,
364 auto *const CmpI = dyn_cast<ICmpInst>(Val);
364 auto *const CmpI = dyn_cast<ICmpInst>(Val);
367 auto Result = visitICmp(CmpI, ICmpInst::ICMP_EQ, BaseId);
378 auto *const CmpI = dyn_cast<ICmpInst>(BranchI->getCondition());
378 auto *const CmpI = dyn_cast<ICmpInst>(BranchI->getCondition());
384 CmpI, FalseBlock == PhiBlock ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE,
384 CmpI, FalseBlock == PhiBlock ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE,
824 if (!isa<ICmpInst>(Phi.getIncomingValue(I)) ||
825 cast<ICmpInst>(Phi.getIncomingValue(I))->getParent() !=
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp 2593 if (isa<ICmpInst>(Cond) && Cond->hasOneUse()) {
lib/Transforms/Scalar/SCCP.cpp 1652 cast<ICmpInst>(&I)->isEquality())
lib/Transforms/Scalar/Scalarizer.cpp 117 ICmpSplitter(ICmpInst &ici) : ICI(ici) {}
124 ICmpInst &ICI;
186 bool visitICmpInst(ICmpInst &ICI);
582 bool ScalarizerVisitor::visitICmpInst(ICmpInst &ICI) {
lib/Transforms/Utils/FlattenCFG.cpp 262 CI->setPredicate(ICmpInst::getInversePredicate(Predicate));
lib/Transforms/Utils/LoopUnrollPeel.cpp 198 SE.isKnownPredicate(ICmpInst::getInversePredicate(Pred), LeftSCEV,
207 Pred = ICmpInst::getSwappedPredicate(Pred);
238 Pred = ICmpInst::getInversePredicate(Pred);
250 SE.isKnownPredicate(ICmpInst::getInversePredicate(Pred), IterVal,
lib/Transforms/Utils/LoopUtils.cpp 1002 SE.isLoopEntryGuardedByCond(L, ICmpInst::ICMP_SLT, S, Zero);
1009 SE.isLoopEntryGuardedByCond(L, ICmpInst::ICMP_SGE, S, Zero);
1017 auto Predicate = Signed ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
1017 auto Predicate = Signed ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
1028 auto Predicate = Signed ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
1028 auto Predicate = Signed ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
lib/Transforms/Utils/LowerMemIntrinsics.cpp 303 ICmpInst *PtrCompare = new ICmpInst(InsertBefore, ICmpInst::ICMP_ULT,
303 ICmpInst *PtrCompare = new ICmpInst(InsertBefore, ICmpInst::ICMP_ULT,
303 ICmpInst *PtrCompare = new ICmpInst(InsertBefore, ICmpInst::ICMP_ULT,
323 ICmpInst *CompareN =
324 new ICmpInst(OrigBB->getTerminator(), ICmpInst::ICMP_EQ, CopyLen,
324 new ICmpInst(OrigBB->getTerminator(), ICmpInst::ICMP_EQ, CopyLen,
lib/Transforms/Utils/LowerSwitch.cpp 311 ICmpInst* Comp = new ICmpInst(ICmpInst::ICMP_SLT,
311 ICmpInst* Comp = new ICmpInst(ICmpInst::ICMP_SLT,
311 ICmpInst* Comp = new ICmpInst(ICmpInst::ICMP_SLT,
342 ICmpInst* Comp = nullptr;
345 Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_EQ, Val,
345 Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_EQ, Val,
351 Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_SLE, Val, Leaf.High,
351 Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_SLE, Val, Leaf.High,
355 Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_SGE, Val, Leaf.Low,
355 Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_SGE, Val, Leaf.Low,
359 Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_ULE, Val, Leaf.High,
359 Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_ULE, Val, Leaf.High,
368 Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_ULE, Add, UpperBound,
368 Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_ULE, Add, UpperBound,
lib/Transforms/Utils/PromoteMemoryToRegister.cpp 307 ICmpInst *LoadNotNull = new ICmpInst(ICmpInst::ICMP_NE, LI,
307 ICmpInst *LoadNotNull = new ICmpInst(ICmpInst::ICMP_NE, LI,
307 ICmpInst *LoadNotNull = new ICmpInst(ICmpInst::ICMP_NE, LI,
lib/Transforms/Utils/SimplifyCFG.cpp 205 bool tryToSimplifyUncondBranchWithICmpInIt(ICmpInst *ICI,
492 ICmpInst *ICI;
494 if (!((ICI = dyn_cast<ICmpInst>(I)) &&
505 if (ICI->getPredicate() == (isEQ ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE)) {
505 if (ICI->getPredicate() == (isEQ ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE)) {
708 if (ICmpInst *ICI = dyn_cast<ICmpInst>(BI->getCondition())) {
708 if (ICmpInst *ICI = dyn_cast<ICmpInst>(BI->getCondition())) {
737 ICmpInst *ICI = cast<ICmpInst>(BI->getCondition());
737 ICmpInst *ICI = cast<ICmpInst>(BI->getCondition());
738 BasicBlock *Succ = BI->getSuccessor(ICI->getPredicate() == ICmpInst::ICMP_NE);
741 return BI->getSuccessor(ICI->getPredicate() == ICmpInst::ICMP_EQ);
982 ICmpInst *ICI = cast<ICmpInst>(BI->getCondition());
982 ICmpInst *ICI = cast<ICmpInst>(BI->getCondition());
983 if (ICI->getPredicate() == ICmpInst::ICMP_EQ)
3591 ICmpInst *ICI, IRBuilder<> &Builder) {
3634 if (ICI->getPredicate() == ICmpInst::ICMP_EQ)
3658 if (ICI->getPredicate() == ICmpInst::ICMP_EQ)
5229 ICmpInst *CmpInst = dyn_cast<ICmpInst>(PhiUser);
5229 ICmpInst *CmpInst = dyn_cast<ICmpInst>(PhiUser);
5822 if (ICmpInst *ICI = dyn_cast<ICmpInst>(I))
5822 if (ICmpInst *ICI = dyn_cast<ICmpInst>(I))
lib/Transforms/Utils/SimplifyIndVar.cpp 87 bool makeIVComparisonInvariant(ICmpInst *ICmp, Value *IVOperand);
88 void eliminateIVComparison(ICmpInst *ICmp, Value *IVOperand);
175 bool SimplifyIndvar::makeIVComparisonInvariant(ICmpInst *ICmp,
178 ICmpInst::Predicate Pred = ICmp->getPredicate();
183 Pred = ICmpInst::getSwappedPredicate(Pred);
192 ICmpInst::Predicate InvariantPredicate;
245 void SimplifyIndvar::eliminateIVComparison(ICmpInst *ICmp, Value *IVOperand) {
247 ICmpInst::Predicate Pred = ICmp->getPredicate();
248 ICmpInst::Predicate OriginalPred = Pred;
253 Pred = ICmpInst::getSwappedPredicate(Pred);
268 } else if (SE->isKnownPredicate(ICmpInst::getInversePredicate(Pred), S, X)) {
274 } else if (ICmpInst::isSigned(OriginalPred) &&
284 ICmp->setPredicate(ICmpInst::getUnsignedPredicate(OriginalPred));
344 ICmpInst *ICmp = new ICmpInst(Rem, ICmpInst::ICMP_EQ, N, D);
344 ICmpInst *ICmp = new ICmpInst(Rem, ICmpInst::ICMP_EQ, N, D);
344 ICmpInst *ICmp = new ICmpInst(Rem, ICmpInst::ICMP_EQ, N, D);
383 auto LT = IsSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
383 auto LT = IsSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
538 SmallVector<ICmpInst *, 4> ICmpUsers;
544 ICmpInst *ICI = dyn_cast<ICmpInst>(U);
544 ICmpInst *ICI = dyn_cast<ICmpInst>(U);
578 for (auto *ICI : ICmpUsers) {
588 ICmpInst::Predicate Pred = ICI->getPredicate();
589 if (IsSwapped) Pred = ICmpInst::getSwappedPredicate(Pred);
593 Pred = ICmpInst::getUnsignedPredicate(Pred);
602 ICmpInst *NewICI = new ICmpInst(ICI, Pred, IV, Ext);
602 ICmpInst *NewICI = new ICmpInst(ICI, Pred, IV, Ext);
618 if (ICmpInst *ICmp = dyn_cast<ICmpInst>(UseInst)) {
618 if (ICmpInst *ICmp = dyn_cast<ICmpInst>(UseInst)) {
lib/Transforms/Utils/SimplifyLibCalls.cpp 95 if (ICmpInst *IC = dyn_cast<ICmpInst>(U))
95 if (ICmpInst *IC = dyn_cast<ICmpInst>(U))
165 if (ICmpInst *IC = dyn_cast<ICmpInst>(U))
165 if (ICmpInst *IC = dyn_cast<ICmpInst>(U))
851 ICmpInst *Old = cast<ICmpInst>(*UI++);
851 ICmpInst *Old = cast<ICmpInst>(*UI++);
962 Value *Bounds = B.CreateICmp(ICmpInst::ICMP_ULT, C, B.getIntN(Width, Width),
lib/Transforms/Vectorize/LoopVectorize.cpp 2688 auto P = Cost->requiresScalarEpilogue() ? ICmpInst::ICMP_ULE
2689 : ICmpInst::ICMP_ULT;
3331 } else if (auto *CI = dyn_cast<ICmpInst>(I)) {
3331 } else if (auto *CI = dyn_cast<ICmpInst>(I)) {
tools/bugpoint/Miscompilation.cpp 884 Value *IsNull = new ICmpInst(*EntryBB, ICmpInst::ICMP_EQ, CachedVal,
884 Value *IsNull = new ICmpInst(*EntryBB, ICmpInst::ICMP_EQ, CachedVal,
tools/clang/lib/CodeGen/CGBuiltin.cpp 5326 return EmitAArch64CompareBuiltinExpr(Ops[0], Ty, ICmpInst::FCMP_OEQ,
5327 ICmpInst::ICMP_EQ, "vceqz");
5330 return EmitAArch64CompareBuiltinExpr(Ops[0], Ty, ICmpInst::FCMP_OGE,
5331 ICmpInst::ICMP_SGE, "vcgez");
5334 return EmitAArch64CompareBuiltinExpr(Ops[0], Ty, ICmpInst::FCMP_OLE,
5335 ICmpInst::ICMP_SLE, "vclez");
5338 return EmitAArch64CompareBuiltinExpr(Ops[0], Ty, ICmpInst::FCMP_OGT,
5339 ICmpInst::ICMP_SGT, "vcgtz");
5342 return EmitAArch64CompareBuiltinExpr(Ops[0], Ty, ICmpInst::FCMP_OLT,
5343 ICmpInst::ICMP_SLT, "vcltz");
5722 Ops[0] = Builder.CreateICmp(ICmpInst::ICMP_NE, Ops[0],
6973 Value *CmpRes = Builder.CreateICmp(ICmpInst::ICMP_UGE, Ops[2], EightV);
6991 Value *CmpRes = Builder.CreateICmp(ICmpInst::ICMP_UGE, Ops[4],
7741 ICmpInst::FCMP_OEQ, ICmpInst::ICMP_EQ, "vceqz");
7741 ICmpInst::FCMP_OEQ, ICmpInst::ICMP_EQ, "vceqz");
7749 ICmpInst::FCMP_OGE, ICmpInst::ICMP_SGE, "vcgez");
7749 ICmpInst::FCMP_OGE, ICmpInst::ICMP_SGE, "vcgez");
7757 ICmpInst::FCMP_OLE, ICmpInst::ICMP_SLE, "vclez");
7757 ICmpInst::FCMP_OLE, ICmpInst::ICMP_SLE, "vclez");
7765 ICmpInst::FCMP_OGT, ICmpInst::ICMP_SGT, "vcgtz");
7765 ICmpInst::FCMP_OGT, ICmpInst::ICMP_SGT, "vcgtz");
7773 ICmpInst::FCMP_OLT, ICmpInst::ICMP_SLT, "vcltz");
7773 ICmpInst::FCMP_OLT, ICmpInst::ICMP_SLT, "vcltz");
7856 case NEON::BI__builtin_neon_vceqd_u64:P = llvm::ICmpInst::ICMP_EQ;break;
7857 case NEON::BI__builtin_neon_vcgtd_s64:P = llvm::ICmpInst::ICMP_SGT;break;
7858 case NEON::BI__builtin_neon_vcgtd_u64:P = llvm::ICmpInst::ICMP_UGT;break;
7859 case NEON::BI__builtin_neon_vcltd_s64:P = llvm::ICmpInst::ICMP_SLT;break;
7860 case NEON::BI__builtin_neon_vcltd_u64:P = llvm::ICmpInst::ICMP_ULT;break;
7861 case NEON::BI__builtin_neon_vcged_u64:P = llvm::ICmpInst::ICMP_UGE;break;
7862 case NEON::BI__builtin_neon_vcged_s64:P = llvm::ICmpInst::ICMP_SGE;break;
7863 case NEON::BI__builtin_neon_vcled_u64:P = llvm::ICmpInst::ICMP_ULE;break;
7864 case NEON::BI__builtin_neon_vcled_s64:P = llvm::ICmpInst::ICMP_SLE;break;
7878 Ops[0] = Builder.CreateICmp(ICmpInst::ICMP_NE, Ops[0],
9625 Pred = IsSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
9625 Pred = IsSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
9628 Pred = IsSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE;
9628 Pred = IsSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE;
9631 Pred = IsSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
9631 Pred = IsSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
9634 Pred = IsSigned ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE;
9634 Pred = IsSigned ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE;
9637 Pred = ICmpInst::ICMP_EQ;
9640 Pred = ICmpInst::ICMP_NE;
9720 ICmpInst::Predicate Pred;
9723 case 0: Pred = ICmpInst::ICMP_EQ; break;
9724 case 1: Pred = Signed ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT; break;
9724 case 1: Pred = Signed ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT; break;
9725 case 2: Pred = Signed ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE; break;
9725 case 2: Pred = Signed ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE; break;
9726 case 4: Pred = ICmpInst::ICMP_NE; break;
9727 case 5: Pred = Signed ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE; break;
9727 case 5: Pred = Signed ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE; break;
9728 case 6: Pred = Signed ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; break;
9728 case 6: Pred = Signed ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; break;
9769 Value *Cmp = CGF.Builder.CreateICmp(ICmpInst::ICMP_SGT, Ops[0], Zero);
9774 static Value *EmitX86MinMax(CodeGenFunction &CGF, ICmpInst::Predicate Pred,
11701 return EmitX86MinMax(*this, ICmpInst::ICMP_SGT, Ops);
11714 return EmitX86MinMax(*this, ICmpInst::ICMP_UGT, Ops);
11727 return EmitX86MinMax(*this, ICmpInst::ICMP_SLT, Ops);
11740 return EmitX86MinMax(*this, ICmpInst::ICMP_ULT, Ops);
tools/clang/lib/CodeGen/CGExprAgg.cpp 945 using II = llvm::ICmpInst;
tools/clang/lib/CodeGen/CGExprScalar.cpp 1066 return Builder.CreateICmp(llvm::ICmpInst::ICMP_SLT, V, Zero,
tools/clang/lib/CodeGen/ItaniumCXXABI.cpp 1047 llvm::ICmpInst::Predicate Eq;
1050 Eq = llvm::ICmpInst::ICMP_NE;
1054 Eq = llvm::ICmpInst::ICMP_EQ;
tools/clang/lib/CodeGen/MicrosoftCXXABI.cpp 2825 llvm::ICmpInst::Predicate Eq;
2828 Eq = llvm::ICmpInst::ICMP_NE;
2832 Eq = llvm::ICmpInst::ICMP_EQ;
tools/lldb/source/Expression/IRInterpreter.cpp 544 ICmpInst *icmp_inst = dyn_cast<ICmpInst>(ii);
544 ICmpInst *icmp_inst = dyn_cast<ICmpInst>(ii);
1079 const ICmpInst *icmp_inst = dyn_cast<ICmpInst>(inst);
1079 const ICmpInst *icmp_inst = dyn_cast<ICmpInst>(inst);
tools/polly/include/polly/CodeGen/LoopGenerators.h 67 BasicBlock *&ExitBlock, ICmpInst::Predicate Predicate,
tools/polly/lib/Analysis/ScopBuilder.cpp 264 static isl::set buildConditionSet(ICmpInst::Predicate Pred, isl::pw_aff L,
267 case ICmpInst::ICMP_EQ:
269 case ICmpInst::ICMP_NE:
271 case ICmpInst::ICMP_SLT:
273 case ICmpInst::ICMP_SLE:
275 case ICmpInst::ICMP_SGT:
277 case ICmpInst::ICMP_SGE:
279 case ICmpInst::ICMP_ULT:
281 case ICmpInst::ICMP_UGT:
283 case ICmpInst::ICMP_ULE:
285 case ICmpInst::ICMP_UGE:
408 buildConditionSet(ICmpInst::ICMP_EQ, isl::manage_copy(LHS),
440 ConsequenceCondSet = buildConditionSet(ICmpInst::ICMP_SLE, isl::manage(LHS),
480 auto *ICond = dyn_cast<ICmpInst>(Condition);
480 auto *ICond = dyn_cast<ICmpInst>(Condition);
498 case ICmpInst::ICMP_ULT:
503 case ICmpInst::ICMP_ULE:
508 case ICmpInst::ICMP_UGT:
513 case ICmpInst::ICMP_UGE:
tools/polly/lib/Analysis/ScopDetection.cpp 587 if (!isa<ICmpInst>(Condition)) {
594 ICmpInst *ICmp = cast<ICmpInst>(Condition);
594 ICmpInst *ICmp = cast<ICmpInst>(Condition);
tools/polly/lib/CodeGen/IslNodeBuilder.cpp 111 ICmpInst::Predicate &Predicate) {
121 Predicate = ICmpInst::ICMP_SLE;
124 Predicate = ICmpInst::ICMP_SLT;
tools/polly/lib/CodeGen/LoopGenerators.cpp 85 ICmpInst::Predicate Predicate,
tools/polly/lib/CodeGen/LoopGeneratorsGOMP.cpp 157 createLoop(LB, UB, Stride, Builder, LI, DT, AfterBB, ICmpInst::ICMP_SLE,
tools/polly/lib/CodeGen/LoopGeneratorsKMP.cpp 255 ICmpInst::ICMP_SLE, nullptr, true,
tools/polly/lib/Support/SCEVValidator.cpp 679 if (auto *ICmp = dyn_cast<ICmpInst>(V)) {
679 if (auto *ICmp = dyn_cast<ICmpInst>(V)) {
unittests/Analysis/ScalarEvolutionTest.cpp 851 Builder.CreateICmp(ICmpInst::ICMP_SLT, Add, Limit, "cond"));
883 ICmpInst::ICMP_SLT, Add, ConstantInt::get(T_int64, 2000), "new.cond");
951 Builder.CreateICmp(ICmpInst::ICMP_SLT, Add, Load, "cond"));
972 ICmpInst::ICMP_SLT, Add, ConstantInt::get(T_int64, 2000), "new.cond");
1177 Builder.CreateICmp(ICmpInst::ICMP_SLT, Add, Limit, "cond"));
unittests/IR/InstructionsTest.cpp 329 ICmpInst *ICmp0 = new ICmpInst(ICmpInst::ICMP_SGT, PtrVecA, PtrVecB);
329 ICmpInst *ICmp0 = new ICmpInst(ICmpInst::ICMP_SGT, PtrVecA, PtrVecB);
329 ICmpInst *ICmp0 = new ICmpInst(ICmpInst::ICMP_SGT, PtrVecA, PtrVecB);
330 ICmpInst *ICmp1 = new ICmpInst(ICmpInst::ICMP_ULT, PtrVecA, PtrVecB);
330 ICmpInst *ICmp1 = new ICmpInst(ICmpInst::ICMP_ULT, PtrVecA, PtrVecB);
330 ICmpInst *ICmp1 = new ICmpInst(ICmpInst::ICMP_ULT, PtrVecA, PtrVecB);
335 ICmpInst *ICmp2 = new ICmpInst(*BB0, ICmpInst::ICMP_SGE, PtrVecA, PtrVecB);
335 ICmpInst *ICmp2 = new ICmpInst(*BB0, ICmpInst::ICMP_SGE, PtrVecA, PtrVecB);
335 ICmpInst *ICmp2 = new ICmpInst(*BB0, ICmpInst::ICMP_SGE, PtrVecA, PtrVecB);
unittests/IR/PatternMatch.cpp 1127 ICmpInst::Predicate Pred = ICmpInst::ICMP_UGT;
1127 ICmpInst::Predicate Pred = ICmpInst::ICMP_UGT;
1131 ICmpInst::Predicate MatchPred;
usr/include/c++/7.4.0/type_traits 1983 { typedef _Up type; };
utils/unittest/googletest/include/gtest/gtest-printers.h 407 T* p, ::std::ostream* os) {
416 if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) {