Lines Matching defs:FoundLHS

11666   const SCEV *FoundLHS = getSCEV(ICI->getOperand(0));
11669 return isImpliedCond(Pred, LHS, RHS, FoundPred, FoundLHS, FoundRHS, CtxI);
11675 const SCEV *FoundLHS, const SCEV *FoundRHS,
11679 getTypeSizeInBits(FoundLHS->getType())) {
11683 if (!CmpInst::isSigned(FoundPred) && !FoundLHS->getType()->isPointerTy() &&
11686 auto *WideType = FoundLHS->getType();
11690 if (isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_ULE, FoundLHS,
11694 const SCEV *TruncFoundLHS = getTruncateExpr(FoundLHS, NarrowType);
11705 LHS = getSignExtendExpr(LHS, FoundLHS->getType());
11706 RHS = getSignExtendExpr(RHS, FoundLHS->getType());
11708 LHS = getZeroExtendExpr(LHS, FoundLHS->getType());
11709 RHS = getZeroExtendExpr(RHS, FoundLHS->getType());
11712 getTypeSizeInBits(FoundLHS->getType())) {
11713 if (FoundLHS->getType()->isPointerTy() || FoundRHS->getType()->isPointerTy())
11716 FoundLHS = getSignExtendExpr(FoundLHS, LHS->getType());
11719 FoundLHS = getZeroExtendExpr(FoundLHS, LHS->getType());
11723 return isImpliedCondBalancedTypes(Pred, LHS, RHS, FoundPred, FoundLHS,
11729 ICmpInst::Predicate FoundPred, const SCEV *FoundLHS, const SCEV *FoundRHS,
11732 getTypeSizeInBits(FoundLHS->getType()) &&
11739 if (SimplifyICmpOperands(FoundPred, FoundLHS, FoundRHS))
11740 if (FoundLHS == FoundRHS)
11744 if (LHS == FoundRHS || RHS == FoundLHS) {
11746 std::swap(FoundLHS, FoundRHS);
11756 return isImpliedCondOperands(Pred, LHS, RHS, FoundLHS, FoundRHS, CtxI);
11762 // 0. LHS Pred RHS <- FoundLHS SwapPred FoundRHS
11764 // 1. LHS Pred RHS <- FoundRHS Pred FoundLHS
11765 // 2. RHS SwapPred LHS <- FoundLHS SwapPred FoundRHS
11766 // 3. LHS Pred RHS <- ~FoundLHS Pred ~FoundRHS
11767 // 4. ~LHS SwapPred ~RHS <- FoundLHS SwapPred FoundRHS
11771 return isImpliedCondOperands(FoundPred, RHS, LHS, FoundLHS, FoundRHS,
11773 if (!isa<SCEVConstant>(FoundRHS) && !isa<SCEVAddRecExpr>(FoundLHS))
11774 return isImpliedCondOperands(Pred, LHS, RHS, FoundRHS, FoundLHS, CtxI);
11781 FoundLHS, FoundRHS, CtxI))
11784 if (!FoundLHS->getType()->isPointerTy() &&
11786 isImpliedCondOperands(Pred, LHS, RHS, getNotSCEV(FoundLHS),
11802 if ((isKnownNonNegative(FoundLHS) && isKnownNonNegative(FoundRHS)) ||
11803 (isKnownNegative(FoundLHS) && isKnownNegative(FoundRHS)))
11804 return isImpliedCondOperands(Pred, LHS, RHS, FoundLHS, FoundRHS, CtxI);
11809 *CanonicalFoundLHS = FoundLHS, *CanonicalFoundRHS = FoundRHS;
11839 (isa<SCEVConstant>(FoundLHS) || isa<SCEVConstant>(FoundRHS))) {
11844 if (isa<SCEVConstant>(FoundLHS)) {
11845 C = cast<SCEVConstant>(FoundLHS);
11849 V = FoundLHS;
11917 if (isImpliedCondOperands(Pred, LHS, RHS, FoundLHS, FoundRHS, CtxI))
11921 if (isImpliedCondOperands(FoundPred, LHS, RHS, FoundLHS, FoundRHS, CtxI))
11924 if (isImpliedCondOperandsViaRanges(Pred, LHS, RHS, FoundPred, FoundLHS, FoundRHS))
12005 const SCEV *FoundLHS, const SCEV *FoundRHS, const Instruction *CtxI) {
12011 // FoundLHS = {Start,+,W}
12013 // known(Pred, FoundLHS, FoundRHS)
12017 // this case, `FoundLHS Pred FoundRHS` implies `Start Pred FoundRHS`. Try to
12023 if (auto *AR = dyn_cast<SCEVAddRecExpr>(FoundLHS)) {
12040 if (!isAvailableAtLoopEntry(FoundLHS, AR->getLoop()))
12042 return isImpliedCondOperands(Pred, LHS, RHS, FoundLHS, AR->getStart());
12050 const SCEV *FoundLHS, const SCEV *FoundRHS) {
12058 const auto *AddRecFoundLHS = dyn_cast<SCEVAddRecExpr>(FoundLHS);
12070 // FoundLHS u< FoundRHS u< -C => (FoundLHS + C) u< (FoundRHS + C) ... (1)
12072 // FoundLHS s< FoundRHS s< INT_MIN - C => (FoundLHS + C) s< (FoundRHS + C)
12081 // FoundLHS s< FoundRHS s< INT_MIN - C
12082 // <=> (FoundLHS + INT_MIN) u< (FoundRHS + INT_MIN) u< -C [ using (3) ]
12083 // <=> (FoundLHS + INT_MIN + C) u< (FoundRHS + INT_MIN + C) [ using (1) ]
12084 // <=> (FoundLHS + INT_MIN + C + INT_MIN) s<
12086 // <=> FoundLHS + C s< FoundRHS + C
12096 // will not sign underflow. For instance, say FoundLHS = (i8 -128), FoundRHS
12099 // neither necessary nor sufficient to prove "(FoundLHS + C) s< (FoundRHS +
12102 std::optional<APInt> LDiff = computeConstantDifference(LHS, FoundLHS);
12127 const SCEV *FoundLHS,
12173 std::swap(FoundLHS, FoundRHS);
12184 isImpliedCondOperandsViaRanges(Pred, S1, S2, Pred, FoundLHS, FoundRHS) ||
12185 isImpliedViaOperations(Pred, S1, S2, FoundLHS, FoundRHS, Depth);
12242 const SCEV *FoundLHS,
12248 std::swap(FoundLHS, FoundRHS);
12251 if (LHS != FoundLHS)
12283 const SCEV *FoundLHS,
12286 if (isImpliedCondOperandsViaRanges(Pred, LHS, RHS, Pred, FoundLHS, FoundRHS))
12289 if (isImpliedCondOperandsViaNoOverflow(Pred, LHS, RHS, FoundLHS, FoundRHS))
12292 if (isImpliedCondOperandsViaShift(Pred, LHS, RHS, FoundLHS, FoundRHS))
12295 if (isImpliedCondOperandsViaAddRecStart(Pred, LHS, RHS, FoundLHS, FoundRHS,
12300 FoundLHS, FoundRHS);
12382 const SCEV *FoundLHS,
12388 assert(getTypeSizeInBits(FoundLHS->getType()) ==
12390 "FoundLHS and FoundRHS have different sizes?");
12399 std::swap(FoundLHS, FoundRHS);
12407 if (isKnownNonNegative(FoundLHS) && isKnownNonNegative(FoundRHS)) {
12408 // Knowing that both FoundLHS and FoundRHS are non-negative, and knowing
12409 // FoundLHS >u FoundRHS, we also know that FoundLHS >s FoundRHS. Let us
12412 if (isImpliedCondOperands(ICmpInst::ICMP_SGT, LHS, MinusOne, FoundLHS,
12414 isImpliedCondOperands(ICmpInst::ICMP_SGT, RHS, MinusOne, FoundLHS,
12432 auto *OrigFoundLHS = FoundLHS;
12434 FoundLHS = GetOpFromSExt(FoundLHS);
12489 // We want to make sure that LHS = FoundLHS / Denominator. If it is so,
12490 // then a SCEV for the numerator already exists and matches with FoundLHS.
12492 if (!Numerator || Numerator->getType() != FoundLHS->getType())
12495 // Make sure that the numerator matches with FoundLHS and the denominator
12497 if (!HasSameValue(Numerator, FoundLHS) || !isKnownPositive(Denominator))
12510 // FoundLHS > FoundRHS, LHS = FoundLHS / Denominator, Denominator > 0.
12517 // For example, given that FoundLHS > 2. It means that FoundLHS is at
12526 // For example, given that FoundLHS > -3. Then FoundLHS is at least -2.
12528 // 1. If FoundLHS is negative, then the result is 0.
12529 // 2. If FoundLHS is non-negative, then the result is non-negative.
12593 const SCEV *FoundLHS,
12599 if (HasSameValue(LHS, FoundLHS) && HasSameValue(RHS, FoundRHS))
12604 if (isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_SLE, LHS, FoundLHS) &&
12610 if (isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_SGE, LHS, FoundLHS) &&
12616 if (isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_ULE, LHS, FoundLHS) &&
12622 if (isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_UGE, LHS, FoundLHS) &&
12629 if (isImpliedViaOperations(Pred, LHS, RHS, FoundLHS, FoundRHS))
12639 const SCEV *FoundLHS,
12646 std::optional<APInt> Addend = computeConstantDifference(LHS, FoundLHS);
12652 // `FoundLHSRange` is the range we know `FoundLHS` to be in by virtue of the
12653 // antecedent "`FoundLHS` `FoundPred` `FoundRHS`".
12657 // Since `LHS` is `FoundLHS` + `Addend`, we can compute a range for `LHS`: