Lines Matching refs:ConstantRange

44 ConstantRange::ConstantRange(uint32_t BitWidth, bool Full)  in ConstantRange()  function in ConstantRange
48 ConstantRange::ConstantRange(APInt V) in ConstantRange() function in ConstantRange
51 ConstantRange::ConstantRange(APInt L, APInt U) in ConstantRange() function in ConstantRange
59 ConstantRange ConstantRange::fromKnownBits(const KnownBits &Known, in fromKnownBits()
69 return ConstantRange(Known.getMinValue(), Known.getMaxValue() + 1); in fromKnownBits()
76 return ConstantRange(Lower, Upper + 1); in fromKnownBits()
79 KnownBits ConstantRange::toKnownBits() const { in toKnownBits()
97 ConstantRange ConstantRange::makeAllowedICmpRegion(CmpInst::Predicate Pred, in makeAllowedICmpRegion()
98 const ConstantRange &CR) { in makeAllowedICmpRegion()
110 return ConstantRange(CR.getUpper(), CR.getLower()); in makeAllowedICmpRegion()
116 return ConstantRange(APInt::getMinValue(W), std::move(UMax)); in makeAllowedICmpRegion()
122 return ConstantRange(APInt::getSignedMinValue(W), std::move(SMax)); in makeAllowedICmpRegion()
132 return ConstantRange(std::move(UMin) + 1, APInt::getZero(W)); in makeAllowedICmpRegion()
138 return ConstantRange(std::move(SMin) + 1, APInt::getSignedMinValue(W)); in makeAllowedICmpRegion()
147 ConstantRange ConstantRange::makeSatisfyingICmpRegion(CmpInst::Predicate Pred, in makeSatisfyingICmpRegion()
148 const ConstantRange &CR) { in makeSatisfyingICmpRegion()
157 ConstantRange ConstantRange::makeExactICmpRegion(CmpInst::Predicate Pred, in makeExactICmpRegion()
169 bool ConstantRange::areInsensitiveToSignednessOfICmpPredicate( in areInsensitiveToSignednessOfICmpPredicate()
170 const ConstantRange &CR1, const ConstantRange &CR2) { in areInsensitiveToSignednessOfICmpPredicate()
178 bool ConstantRange::areInsensitiveToSignednessOfInvertedICmpPredicate( in areInsensitiveToSignednessOfInvertedICmpPredicate()
179 const ConstantRange &CR1, const ConstantRange &CR2) { in areInsensitiveToSignednessOfInvertedICmpPredicate()
187 CmpInst::Predicate ConstantRange::getEquivalentPredWithFlippedSignedness( in getEquivalentPredWithFlippedSignedness()
188 CmpInst::Predicate Pred, const ConstantRange &CR1, in getEquivalentPredWithFlippedSignedness()
189 const ConstantRange &CR2) { in getEquivalentPredWithFlippedSignedness()
205 void ConstantRange::getEquivalentICmp(CmpInst::Predicate &Pred, in getEquivalentICmp()
231 assert(ConstantRange::makeExactICmpRegion(Pred, RHS) == add(Offset) && in getEquivalentICmp()
235 bool ConstantRange::getEquivalentICmp(CmpInst::Predicate &Pred, in getEquivalentICmp()
242 bool ConstantRange::icmp(CmpInst::Predicate Pred, in icmp()
243 const ConstantRange &Other) const { in icmp()
277 static ConstantRange makeExactMulNUWRegion(const APInt &V) { in makeExactMulNUWRegion()
280 return ConstantRange::getFull(V.getBitWidth()); in makeExactMulNUWRegion()
282 return ConstantRange::getNonEmpty( in makeExactMulNUWRegion()
290 static ConstantRange makeExactMulNSWRegion(const APInt &V) { in makeExactMulNSWRegion()
294 return ConstantRange::getFull(BitWidth); in makeExactMulNSWRegion()
300 return ConstantRange(-MaxValue, MinValue); in makeExactMulNSWRegion()
310 return ConstantRange::getNonEmpty(Lower, Upper + 1); in makeExactMulNSWRegion()
313 ConstantRange
314 ConstantRange::makeGuaranteedNoWrapRegion(Instruction::BinaryOps BinOp, in makeGuaranteedNoWrapRegion()
315 const ConstantRange &Other, in makeGuaranteedNoWrapRegion()
368 ConstantRange ShAmt = Other.intersectWith( in makeGuaranteedNoWrapRegion()
369 ConstantRange(APInt(BitWidth, 0), APInt(BitWidth, (BitWidth - 1) + 1))); in makeGuaranteedNoWrapRegion()
388 ConstantRange ConstantRange::makeExactNoWrapRegion(Instruction::BinaryOps BinOp, in makeExactNoWrapRegion()
393 return makeGuaranteedNoWrapRegion(BinOp, ConstantRange(Other), NoWrapKind); in makeExactNoWrapRegion()
396 ConstantRange ConstantRange::makeMaskNotEqualRange(const APInt &Mask, in makeMaskNotEqualRange()
409 return ConstantRange::getNonEmpty( in makeMaskNotEqualRange()
413 bool ConstantRange::isFullSet() const { in isFullSet()
417 bool ConstantRange::isEmptySet() const { in isEmptySet()
421 bool ConstantRange::isWrappedSet() const { in isWrappedSet()
425 bool ConstantRange::isUpperWrapped() const { in isUpperWrapped()
429 bool ConstantRange::isSignWrappedSet() const { in isSignWrappedSet()
433 bool ConstantRange::isUpperSignWrapped() const { in isUpperSignWrapped()
438 ConstantRange::isSizeStrictlySmallerThan(const ConstantRange &Other) const { in isSizeStrictlySmallerThan()
448 ConstantRange::isSizeLargerThan(uint64_t MaxSize) const { in isSizeLargerThan()
457 bool ConstantRange::isAllNegative() const { in isAllNegative()
467 bool ConstantRange::isAllNonNegative() const { in isAllNonNegative()
472 bool ConstantRange::isAllPositive() const { in isAllPositive()
482 APInt ConstantRange::getUnsignedMax() const { in getUnsignedMax()
488 APInt ConstantRange::getUnsignedMin() const { in getUnsignedMin()
494 APInt ConstantRange::getSignedMax() const { in getSignedMax()
500 APInt ConstantRange::getSignedMin() const { in getSignedMin()
506 bool ConstantRange::contains(const APInt &V) const { in contains()
515 bool ConstantRange::contains(const ConstantRange &Other) const { in contains()
533 unsigned ConstantRange::getActiveBits() const { in getActiveBits()
540 unsigned ConstantRange::getMinSignedBits() const { in getMinSignedBits()
548 ConstantRange ConstantRange::subtract(const APInt &Val) const { in subtract()
553 return ConstantRange(Lower - Val, Upper - Val); in subtract()
556 ConstantRange ConstantRange::difference(const ConstantRange &CR) const { in difference()
560 static ConstantRange getPreferredRange( in getPreferredRange()
561 const ConstantRange &CR1, const ConstantRange &CR2, in getPreferredRange()
562 ConstantRange::PreferredRangeType Type) { in getPreferredRange()
563 if (Type == ConstantRange::Unsigned) { in getPreferredRange()
568 } else if (Type == ConstantRange::Signed) { in getPreferredRange()
580 ConstantRange ConstantRange::intersectWith(const ConstantRange &CR, in intersectWith()
602 return ConstantRange(CR.Lower, Upper); in intersectWith()
616 return ConstantRange(Lower, CR.Upper); in intersectWith()
633 return ConstantRange(CR.Lower, Upper); in intersectWith()
647 return ConstantRange(Lower, CR.Upper); in intersectWith()
664 return ConstantRange(Lower, CR.Upper); in intersectWith()
678 return ConstantRange(CR.Lower, Upper); in intersectWith()
686 ConstantRange ConstantRange::unionWith(const ConstantRange &CR, in unionWith()
705 ConstantRange(Lower, CR.Upper), ConstantRange(CR.Lower, Upper), Type); in unionWith()
713 return ConstantRange(std::move(L), std::move(U)); in unionWith()
734 ConstantRange(Lower, CR.Upper), ConstantRange(CR.Lower, Upper), Type); in unionWith()
739 return ConstantRange(CR.Lower, Upper); in unionWith()
745 return ConstantRange(Lower, CR.Upper); in unionWith()
756 return ConstantRange(std::move(L), std::move(U)); in unionWith()
759 std::optional<ConstantRange>
760 ConstantRange::exactIntersectWith(const ConstantRange &CR) const { in exactIntersectWith()
762 ConstantRange Result = intersectWith(CR); in exactIntersectWith()
768 std::optional<ConstantRange>
769 ConstantRange::exactUnionWith(const ConstantRange &CR) const { in exactUnionWith()
771 ConstantRange Result = unionWith(CR); in exactUnionWith()
777 ConstantRange ConstantRange::castOp(Instruction::CastOps CastOp, in castOp()
828 ConstantRange ConstantRange::zeroExtend(uint32_t DstTySize) const { in zeroExtend()
838 return ConstantRange(std::move(LowerExt), in zeroExtend()
842 return ConstantRange(Lower.zext(DstTySize), Upper.zext(DstTySize)); in zeroExtend()
845 ConstantRange ConstantRange::signExtend(uint32_t DstTySize) const { in signExtend()
853 return ConstantRange(Lower.sext(DstTySize), Upper.zext(DstTySize)); in signExtend()
856 return ConstantRange(APInt::getHighBitsSet(DstTySize,DstTySize-SrcTySize+1), in signExtend()
860 return ConstantRange(Lower.sext(DstTySize), Upper.sext(DstTySize)); in signExtend()
863 ConstantRange ConstantRange::truncate(uint32_t DstTySize) const { in truncate()
871 ConstantRange Union(DstTySize, /*isFullSet=*/false); in truncate()
882 Union = ConstantRange(APInt::getMaxValue(DstTySize),Upper.trunc(DstTySize)); in truncate()
901 return ConstantRange(LowerDiv.trunc(DstTySize), in truncate()
909 return ConstantRange(LowerDiv.trunc(DstTySize), in truncate()
916 ConstantRange ConstantRange::zextOrTrunc(uint32_t DstTySize) const { in zextOrTrunc()
925 ConstantRange ConstantRange::sextOrTrunc(uint32_t DstTySize) const { in sextOrTrunc()
934 ConstantRange ConstantRange::binaryOp(Instruction::BinaryOps BinOp, in binaryOp()
935 const ConstantRange &Other) const { in binaryOp()
979 ConstantRange ConstantRange::overflowingBinaryOp(Instruction::BinaryOps BinOp, in overflowingBinaryOp()
980 const ConstantRange &Other, in overflowingBinaryOp()
998 bool ConstantRange::isIntrinsicSupported(Intrinsic::ID IntrinsicID) { in isIntrinsicSupported()
1018 ConstantRange ConstantRange::intrinsic(Intrinsic::ID IntrinsicID, in intrinsic()
1019 ArrayRef<ConstantRange> Ops) { in intrinsic()
1063 ConstantRange
1064 ConstantRange::add(const ConstantRange &Other) const { in add()
1075 ConstantRange X = ConstantRange(std::move(NewLower), std::move(NewUpper)); in add()
1083 ConstantRange ConstantRange::addWithNoWrap(const ConstantRange &Other, in addWithNoWrap()
1094 ConstantRange Result = add(Other); in addWithNoWrap()
1110 ConstantRange
1111 ConstantRange::sub(const ConstantRange &Other) const { in sub()
1122 ConstantRange X = ConstantRange(std::move(NewLower), std::move(NewUpper)); in sub()
1130 ConstantRange ConstantRange::subWithNoWrap(const ConstantRange &Other, in subWithNoWrap()
1141 ConstantRange Result = sub(Other); in subWithNoWrap()
1160 ConstantRange
1161 ConstantRange::multiply(const ConstantRange &Other) const { in multiply()
1174 return ConstantRange(APInt::getZero(getBitWidth())).sub(Other); in multiply()
1181 return ConstantRange(APInt::getZero(getBitWidth())).sub(*this); in multiply()
1196 ConstantRange Result_zext = ConstantRange(this_min * Other_min, in multiply()
1198 ConstantRange UR = Result_zext.truncate(getBitWidth()); in multiply()
1222 ConstantRange Result_sext(std::min(L, Compare), std::max(L, Compare) + 1); in multiply()
1223 ConstantRange SR = Result_sext.truncate(getBitWidth()); in multiply()
1228 ConstantRange
1229 ConstantRange::multiplyWithNoWrap(const ConstantRange &Other, in multiplyWithNoWrap()
1237 ConstantRange Result = multiply(Other); in multiplyWithNoWrap()
1248 ConstantRange ConstantRange::smul_fast(const ConstantRange &Other) const { in smul_fast()
1267 ConstantRange
1268 ConstantRange::smax(const ConstantRange &Other) const { in smax()
1275 ConstantRange Res = getNonEmpty(std::move(NewL), std::move(NewU)); in smax()
1281 ConstantRange
1282 ConstantRange::umax(const ConstantRange &Other) const { in umax()
1289 ConstantRange Res = getNonEmpty(std::move(NewL), std::move(NewU)); in umax()
1295 ConstantRange
1296 ConstantRange::smin(const ConstantRange &Other) const { in smin()
1303 ConstantRange Res = getNonEmpty(std::move(NewL), std::move(NewU)); in smin()
1309 ConstantRange
1310 ConstantRange::umin(const ConstantRange &Other) const { in umin()
1317 ConstantRange Res = getNonEmpty(std::move(NewL), std::move(NewU)); in umin()
1323 ConstantRange
1324 ConstantRange::udiv(const ConstantRange &RHS) const { in udiv()
1344 ConstantRange ConstantRange::sdiv(const ConstantRange &RHS) const { in sdiv()
1351 ConstantRange PosFilter = in sdiv()
1353 : ConstantRange(APInt(getBitWidth(), 1), SignedMin); in sdiv()
1354 ConstantRange NegFilter(SignedMin, Zero); in sdiv()
1355 ConstantRange PosL = intersectWith(PosFilter); in sdiv()
1356 ConstantRange NegL = intersectWith(NegFilter); in sdiv()
1357 ConstantRange PosR = RHS.intersectWith(PosFilter); in sdiv()
1358 ConstantRange NegR = RHS.intersectWith(NegFilter); in sdiv()
1360 ConstantRange PosRes = getEmpty(); in sdiv()
1363 PosRes = ConstantRange(PosL.Lower.sdiv(PosR.Upper - 1), in sdiv()
1387 ConstantRange(Lo, NegL.Lower.sdiv(AdjNegRUpper - 1) + 1)); in sdiv()
1402 ConstantRange(std::move(Lo), in sdiv()
1407 ConstantRange(std::move(Lo), NegL.Lower.sdiv(NegR.Upper - 1) + 1)); in sdiv()
1411 ConstantRange NegRes = getEmpty(); in sdiv()
1414 NegRes = ConstantRange((PosL.Upper - 1).sdiv(NegR.Upper - 1), in sdiv()
1420 ConstantRange(NegL.Lower.sdiv(PosR.Lower), in sdiv()
1424 ConstantRange Res = NegRes.unionWith(PosRes, PreferredRangeType::Signed); in sdiv()
1428 Res = Res.unionWith(ConstantRange(Zero)); in sdiv()
1432 ConstantRange ConstantRange::urem(const ConstantRange &RHS) const { in urem()
1454 ConstantRange ConstantRange::srem(const ConstantRange &RHS) const { in srem()
1467 ConstantRange AbsRHS = RHS.abs(); in srem()
1487 return ConstantRange(APInt::getZero(getBitWidth()), std::move(Upper)); in srem()
1496 return ConstantRange(std::move(Lower), APInt(getBitWidth(), 1)); in srem()
1502 return ConstantRange(std::move(Lower), std::move(Upper)); in srem()
1505 ConstantRange ConstantRange::binaryNot() const { in binaryNot()
1506 return ConstantRange(APInt::getAllOnes(getBitWidth())).sub(*this); in binaryNot()
1509 ConstantRange ConstantRange::binaryAnd(const ConstantRange &Other) const { in binaryAnd()
1513 ConstantRange KnownBitsRange = in binaryAnd()
1515 ConstantRange UMinUMaxRange = in binaryAnd()
1521 ConstantRange ConstantRange::binaryOr(const ConstantRange &Other) const { in binaryOr()
1525 ConstantRange KnownBitsRange = in binaryOr()
1528 ConstantRange UMaxUMinRange = in binaryOr()
1534 ConstantRange ConstantRange::binaryXor(const ConstantRange &Other) const { in binaryXor()
1551 ConstantRange CR = fromKnownBits(Known, /*IsSigned*/ false); in binaryXor()
1566 ConstantRange
1567 ConstantRange::shl(const ConstantRange &Other) const { in shl()
1592 return ConstantRange::getNonEmpty(std::move(Min), std::move(Max) + 1); in shl()
1604 return ConstantRange::getNonEmpty(std::move(Min), std::move(Max) + 1); in shl()
1607 ConstantRange
1608 ConstantRange::lshr(const ConstantRange &Other) const { in lshr()
1617 ConstantRange
1618 ConstantRange::ashr(const ConstantRange &Other) const { in ashr()
1668 ConstantRange ConstantRange::uadd_sat(const ConstantRange &Other) const { in uadd_sat()
1677 ConstantRange ConstantRange::sadd_sat(const ConstantRange &Other) const { in sadd_sat()
1686 ConstantRange ConstantRange::usub_sat(const ConstantRange &Other) const { in usub_sat()
1695 ConstantRange ConstantRange::ssub_sat(const ConstantRange &Other) const { in ssub_sat()
1704 ConstantRange ConstantRange::umul_sat(const ConstantRange &Other) const { in umul_sat()
1713 ConstantRange ConstantRange::smul_sat(const ConstantRange &Other) const { in smul_sat()
1734 ConstantRange ConstantRange::ushl_sat(const ConstantRange &Other) const { in ushl_sat()
1743 ConstantRange ConstantRange::sshl_sat(const ConstantRange &Other) const { in sshl_sat()
1754 ConstantRange ConstantRange::inverse() const { in inverse()
1759 return ConstantRange(Upper, Lower); in inverse()
1762 ConstantRange ConstantRange::abs(bool IntMinIsPoison) const { in abs()
1776 return ConstantRange(Lo, APInt::getSignedMinValue(getBitWidth())); in abs()
1778 return ConstantRange(Lo, APInt::getSignedMinValue(getBitWidth()) + 1); in abs()
1793 return ConstantRange(SMin, SMax + 1); in abs()
1797 return ConstantRange(-SMax, -SMin + 1); in abs()
1800 return ConstantRange::getNonEmpty(APInt::getZero(getBitWidth()), in abs()
1804 ConstantRange ConstantRange::ctlz(bool ZeroIsPoison) const { in ctlz()
1824 return ConstantRange( in ctlz()
1829 return ConstantRange(Zero, in ctlz()
1832 return ConstantRange(Zero, APInt(getBitWidth(), getBitWidth())); in ctlz()
1842 static ConstantRange getUnsignedCountTrailingZerosRange(const APInt &Lower, in getUnsignedCountTrailingZerosRange()
1844 assert(!ConstantRange(Lower, Upper).isWrappedSet() && in getUnsignedCountTrailingZerosRange()
1849 return ConstantRange(APInt(BitWidth, Lower.countr_zero())); in getUnsignedCountTrailingZerosRange()
1851 return ConstantRange(APInt::getZero(BitWidth), in getUnsignedCountTrailingZerosRange()
1858 return ConstantRange( in getUnsignedCountTrailingZerosRange()
1864 ConstantRange ConstantRange::cttz(bool ZeroIsPoison) const { in cttz()
1890 ConstantRange CR1 = getUnsignedCountTrailingZerosRange(Lower, Zero); in cttz()
1891 ConstantRange CR2 = in cttz()
1904 ConstantRange CR1 = getUnsignedCountTrailingZerosRange(Lower, Zero); in cttz()
1906 ConstantRange CR2 = getUnsignedCountTrailingZerosRange(Zero, Upper); in cttz()
1910 static ConstantRange getUnsignedPopCountRange(const APInt &Lower, in getUnsignedPopCountRange()
1912 assert(!ConstantRange(Lower, Upper).isWrappedSet() && in getUnsignedPopCountRange()
1917 return ConstantRange(APInt(BitWidth, Lower.popcount())); in getUnsignedPopCountRange()
1933 return ConstantRange(APInt(BitWidth, MinBits), APInt(BitWidth, MaxBits + 1)); in getUnsignedPopCountRange()
1936 ConstantRange ConstantRange::ctpop() const { in ctpop()
1949 ConstantRange CR1 = ConstantRange(APInt(BitWidth, Lower.countl_one()), in ctpop()
1952 ConstantRange CR2 = getUnsignedPopCountRange(Zero, Upper); in ctpop()
1956 ConstantRange::OverflowResult ConstantRange::unsignedAddMayOverflow( in unsignedAddMayOverflow()
1957 const ConstantRange &Other) const { in unsignedAddMayOverflow()
1972 ConstantRange::OverflowResult ConstantRange::signedAddMayOverflow( in signedAddMayOverflow()
1973 const ConstantRange &Other) const { in signedAddMayOverflow()
2002 ConstantRange::OverflowResult ConstantRange::unsignedSubMayOverflow( in unsignedSubMayOverflow()
2003 const ConstantRange &Other) const { in unsignedSubMayOverflow()
2018 ConstantRange::OverflowResult ConstantRange::signedSubMayOverflow( in signedSubMayOverflow()
2019 const ConstantRange &Other) const { in signedSubMayOverflow()
2048 ConstantRange::OverflowResult ConstantRange::unsignedMulMayOverflow( in unsignedMulMayOverflow()
2049 const ConstantRange &Other) const { in unsignedMulMayOverflow()
2068 void ConstantRange::print(raw_ostream &OS) const { in print()
2078 LLVM_DUMP_METHOD void ConstantRange::dump() const { in dump()
2083 ConstantRange llvm::getConstantRangeFromMetadata(const MDNode &Ranges) { in getConstantRangeFromMetadata()
2091 ConstantRange CR(FirstLow->getValue(), FirstHigh->getValue()); in getConstantRangeFromMetadata()
2099 CR = CR.unionWith(ConstantRange(Low->getValue(), High->getValue())); in getConstantRangeFromMetadata()