Lines Matching refs:ConstantRange

43 ConstantRange::ConstantRange(uint32_t BitWidth, bool Full)  in ConstantRange()  function in ConstantRange
47 ConstantRange::ConstantRange(APInt V) in ConstantRange() function in ConstantRange
50 ConstantRange::ConstantRange(APInt L, APInt U) in ConstantRange() function in ConstantRange
58 ConstantRange ConstantRange::fromKnownBits(const KnownBits &Known, in fromKnownBits()
68 return ConstantRange(Known.getMinValue(), Known.getMaxValue() + 1); in fromKnownBits()
75 return ConstantRange(Lower, Upper + 1); in fromKnownBits()
78 ConstantRange ConstantRange::makeAllowedICmpRegion(CmpInst::Predicate Pred, in makeAllowedICmpRegion()
79 const ConstantRange &CR) { in makeAllowedICmpRegion()
91 return ConstantRange(CR.getUpper(), CR.getLower()); in makeAllowedICmpRegion()
97 return ConstantRange(APInt::getMinValue(W), std::move(UMax)); in makeAllowedICmpRegion()
103 return ConstantRange(APInt::getSignedMinValue(W), std::move(SMax)); in makeAllowedICmpRegion()
113 return ConstantRange(std::move(UMin) + 1, APInt::getNullValue(W)); in makeAllowedICmpRegion()
119 return ConstantRange(std::move(SMin) + 1, APInt::getSignedMinValue(W)); in makeAllowedICmpRegion()
128 ConstantRange ConstantRange::makeSatisfyingICmpRegion(CmpInst::Predicate Pred, in makeSatisfyingICmpRegion()
129 const ConstantRange &CR) { in makeSatisfyingICmpRegion()
138 ConstantRange ConstantRange::makeExactICmpRegion(CmpInst::Predicate Pred, in makeExactICmpRegion()
150 bool ConstantRange::getEquivalentICmp(CmpInst::Predicate &Pred, in getEquivalentICmp()
178 assert((!Success || ConstantRange::makeExactICmpRegion(Pred, RHS) == *this) && in getEquivalentICmp()
184 bool ConstantRange::icmp(CmpInst::Predicate Pred, in icmp()
185 const ConstantRange &Other) const { in icmp()
190 static ConstantRange makeExactMulNUWRegion(const APInt &V) { in makeExactMulNUWRegion()
193 return ConstantRange::getFull(V.getBitWidth()); in makeExactMulNUWRegion()
195 return ConstantRange::getNonEmpty( in makeExactMulNUWRegion()
203 static ConstantRange makeExactMulNSWRegion(const APInt &V) { in makeExactMulNSWRegion()
208 return ConstantRange::getFull(BitWidth); in makeExactMulNSWRegion()
214 return ConstantRange(-MaxValue, MinValue); in makeExactMulNSWRegion()
227 return ConstantRange(Lower, Upper + 1); in makeExactMulNSWRegion()
230 ConstantRange
231 ConstantRange::makeGuaranteedNoWrapRegion(Instruction::BinaryOps BinOp, in makeGuaranteedNoWrapRegion()
232 const ConstantRange &Other, in makeGuaranteedNoWrapRegion()
282 ConstantRange ShAmt = Other.intersectWith( in makeGuaranteedNoWrapRegion()
283 ConstantRange(APInt(BitWidth, 0), APInt(BitWidth, (BitWidth - 1) + 1))); in makeGuaranteedNoWrapRegion()
302 ConstantRange ConstantRange::makeExactNoWrapRegion(Instruction::BinaryOps BinOp, in makeExactNoWrapRegion()
307 return makeGuaranteedNoWrapRegion(BinOp, ConstantRange(Other), NoWrapKind); in makeExactNoWrapRegion()
310 bool ConstantRange::isFullSet() const { in isFullSet()
314 bool ConstantRange::isEmptySet() const { in isEmptySet()
318 bool ConstantRange::isWrappedSet() const { in isWrappedSet()
322 bool ConstantRange::isUpperWrapped() const { in isUpperWrapped()
326 bool ConstantRange::isSignWrappedSet() const { in isSignWrappedSet()
330 bool ConstantRange::isUpperSignWrapped() const { in isUpperSignWrapped()
335 ConstantRange::isSizeStrictlySmallerThan(const ConstantRange &Other) const { in isSizeStrictlySmallerThan()
345 ConstantRange::isSizeLargerThan(uint64_t MaxSize) const { in isSizeLargerThan()
355 bool ConstantRange::isAllNegative() const { in isAllNegative()
365 bool ConstantRange::isAllNonNegative() const { in isAllNonNegative()
370 APInt ConstantRange::getUnsignedMax() const { in getUnsignedMax()
376 APInt ConstantRange::getUnsignedMin() const { in getUnsignedMin()
382 APInt ConstantRange::getSignedMax() const { in getSignedMax()
388 APInt ConstantRange::getSignedMin() const { in getSignedMin()
394 bool ConstantRange::contains(const APInt &V) const { in contains()
403 bool ConstantRange::contains(const ConstantRange &Other) const { in contains()
421 unsigned ConstantRange::getActiveBits() const { in getActiveBits()
428 unsigned ConstantRange::getMinSignedBits() const { in getMinSignedBits()
436 ConstantRange ConstantRange::subtract(const APInt &Val) const { in subtract()
441 return ConstantRange(Lower - Val, Upper - Val); in subtract()
444 ConstantRange ConstantRange::difference(const ConstantRange &CR) const { in difference()
448 static ConstantRange getPreferredRange( in getPreferredRange()
449 const ConstantRange &CR1, const ConstantRange &CR2, in getPreferredRange()
450 ConstantRange::PreferredRangeType Type) { in getPreferredRange()
451 if (Type == ConstantRange::Unsigned) { in getPreferredRange()
456 } else if (Type == ConstantRange::Signed) { in getPreferredRange()
468 ConstantRange ConstantRange::intersectWith(const ConstantRange &CR, in intersectWith()
490 return ConstantRange(CR.Lower, Upper); in intersectWith()
504 return ConstantRange(Lower, CR.Upper); in intersectWith()
521 return ConstantRange(CR.Lower, Upper); in intersectWith()
535 return ConstantRange(Lower, CR.Upper); in intersectWith()
552 return ConstantRange(Lower, CR.Upper); in intersectWith()
566 return ConstantRange(CR.Lower, Upper); in intersectWith()
574 ConstantRange ConstantRange::unionWith(const ConstantRange &CR, in unionWith()
593 ConstantRange(Lower, CR.Upper), ConstantRange(CR.Lower, Upper), Type); in unionWith()
601 return ConstantRange(std::move(L), std::move(U)); in unionWith()
622 ConstantRange(Lower, CR.Upper), ConstantRange(CR.Lower, Upper), Type); in unionWith()
627 return ConstantRange(CR.Lower, Upper); in unionWith()
633 return ConstantRange(Lower, CR.Upper); in unionWith()
644 return ConstantRange(std::move(L), std::move(U)); in unionWith()
647 ConstantRange ConstantRange::castOp(Instruction::CastOps CastOp, in castOp()
671 return ConstantRange(std::move(Min), std::move(Max)); in castOp()
678 return ConstantRange(std::move(SMin), std::move(SMax)); in castOp()
690 ConstantRange ConstantRange::zeroExtend(uint32_t DstTySize) const { in zeroExtend()
700 return ConstantRange(std::move(LowerExt), in zeroExtend()
704 return ConstantRange(Lower.zext(DstTySize), Upper.zext(DstTySize)); in zeroExtend()
707 ConstantRange ConstantRange::signExtend(uint32_t DstTySize) const { in signExtend()
715 return ConstantRange(Lower.sext(DstTySize), Upper.zext(DstTySize)); in signExtend()
718 return ConstantRange(APInt::getHighBitsSet(DstTySize,DstTySize-SrcTySize+1), in signExtend()
722 return ConstantRange(Lower.sext(DstTySize), Upper.sext(DstTySize)); in signExtend()
725 ConstantRange ConstantRange::truncate(uint32_t DstTySize) const { in truncate()
733 ConstantRange Union(DstTySize, /*isFullSet=*/false); in truncate()
745 Union = ConstantRange(APInt::getMaxValue(DstTySize),Upper.trunc(DstTySize)); in truncate()
764 return ConstantRange(LowerDiv.trunc(DstTySize), in truncate()
772 return ConstantRange(LowerDiv.trunc(DstTySize), in truncate()
779 ConstantRange ConstantRange::zextOrTrunc(uint32_t DstTySize) const { in zextOrTrunc()
788 ConstantRange ConstantRange::sextOrTrunc(uint32_t DstTySize) const { in sextOrTrunc()
797 ConstantRange ConstantRange::binaryOp(Instruction::BinaryOps BinOp, in binaryOp()
798 const ConstantRange &Other) const { in binaryOp()
842 ConstantRange ConstantRange::overflowingBinaryOp(Instruction::BinaryOps BinOp, in overflowingBinaryOp()
843 const ConstantRange &Other, in overflowingBinaryOp()
859 bool ConstantRange::isIntrinsicSupported(Intrinsic::ID IntrinsicID) { in isIntrinsicSupported()
876 ConstantRange ConstantRange::intrinsic(Intrinsic::ID IntrinsicID, in intrinsic()
877 ArrayRef<ConstantRange> Ops) { in intrinsic()
907 ConstantRange
908 ConstantRange::add(const ConstantRange &Other) const { in add()
919 ConstantRange X = ConstantRange(std::move(NewLower), std::move(NewUpper)); in add()
927 ConstantRange ConstantRange::addWithNoWrap(const ConstantRange &Other, in addWithNoWrap()
938 ConstantRange Result = add(Other); in addWithNoWrap()
954 ConstantRange
955 ConstantRange::sub(const ConstantRange &Other) const { in sub()
966 ConstantRange X = ConstantRange(std::move(NewLower), std::move(NewUpper)); in sub()
974 ConstantRange ConstantRange::subWithNoWrap(const ConstantRange &Other, in subWithNoWrap()
985 ConstantRange Result = sub(Other); in subWithNoWrap()
1004 ConstantRange
1005 ConstantRange::multiply(const ConstantRange &Other) const { in multiply()
1026 ConstantRange Result_zext = ConstantRange(this_min * Other_min, in multiply()
1028 ConstantRange UR = Result_zext.truncate(getBitWidth()); in multiply()
1052 ConstantRange Result_sext(std::min(L, Compare), std::max(L, Compare) + 1); in multiply()
1053 ConstantRange SR = Result_sext.truncate(getBitWidth()); in multiply()
1058 ConstantRange
1059 ConstantRange::smax(const ConstantRange &Other) const { in smax()
1066 ConstantRange Res = getNonEmpty(std::move(NewL), std::move(NewU)); in smax()
1072 ConstantRange
1073 ConstantRange::umax(const ConstantRange &Other) const { in umax()
1080 ConstantRange Res = getNonEmpty(std::move(NewL), std::move(NewU)); in umax()
1086 ConstantRange
1087 ConstantRange::smin(const ConstantRange &Other) const { in smin()
1094 ConstantRange Res = getNonEmpty(std::move(NewL), std::move(NewU)); in smin()
1100 ConstantRange
1101 ConstantRange::umin(const ConstantRange &Other) const { in umin()
1108 ConstantRange Res = getNonEmpty(std::move(NewL), std::move(NewU)); in umin()
1114 ConstantRange
1115 ConstantRange::udiv(const ConstantRange &RHS) const { in udiv()
1135 ConstantRange ConstantRange::sdiv(const ConstantRange &RHS) const { in sdiv()
1141 ConstantRange PosFilter(APInt(getBitWidth(), 1), SignedMin); in sdiv()
1142 ConstantRange NegFilter(SignedMin, Zero); in sdiv()
1143 ConstantRange PosL = intersectWith(PosFilter); in sdiv()
1144 ConstantRange NegL = intersectWith(NegFilter); in sdiv()
1145 ConstantRange PosR = RHS.intersectWith(PosFilter); in sdiv()
1146 ConstantRange NegR = RHS.intersectWith(NegFilter); in sdiv()
1148 ConstantRange PosRes = getEmpty(); in sdiv()
1151 PosRes = ConstantRange(PosL.Lower.sdiv(PosR.Upper - 1), in sdiv()
1175 ConstantRange(Lo, NegL.Lower.sdiv(AdjNegRUpper - 1) + 1)); in sdiv()
1190 ConstantRange(std::move(Lo), in sdiv()
1195 ConstantRange(std::move(Lo), NegL.Lower.sdiv(NegR.Upper - 1) + 1)); in sdiv()
1199 ConstantRange NegRes = getEmpty(); in sdiv()
1202 NegRes = ConstantRange((PosL.Upper - 1).sdiv(NegR.Upper - 1), in sdiv()
1208 ConstantRange(NegL.Lower.sdiv(PosR.Lower), in sdiv()
1212 ConstantRange Res = NegRes.unionWith(PosRes, PreferredRangeType::Signed); in sdiv()
1216 Res = Res.unionWith(ConstantRange(Zero)); in sdiv()
1220 ConstantRange ConstantRange::urem(const ConstantRange &RHS) const { in urem()
1242 ConstantRange ConstantRange::srem(const ConstantRange &RHS) const { in srem()
1255 ConstantRange AbsRHS = RHS.abs(); in srem()
1275 return ConstantRange(APInt::getNullValue(getBitWidth()), std::move(Upper)); in srem()
1284 return ConstantRange(std::move(Lower), APInt(getBitWidth(), 1)); in srem()
1290 return ConstantRange(std::move(Lower), std::move(Upper)); in srem()
1293 ConstantRange ConstantRange::binaryNot() const { in binaryNot()
1294 return ConstantRange(APInt::getAllOnesValue(getBitWidth())).sub(*this); in binaryNot()
1297 ConstantRange
1298 ConstantRange::binaryAnd(const ConstantRange &Other) const { in binaryAnd()
1312 ConstantRange
1313 ConstantRange::binaryOr(const ConstantRange &Other) const { in binaryOr()
1327 ConstantRange ConstantRange::binaryXor(const ConstantRange &Other) const { in binaryXor()
1345 ConstantRange
1346 ConstantRange::shl(const ConstantRange &Other) const { in shl()
1367 return ConstantRange(std::move(min), std::move(max) + 1); in shl()
1370 ConstantRange
1371 ConstantRange::lshr(const ConstantRange &Other) const { in lshr()
1380 ConstantRange
1381 ConstantRange::ashr(const ConstantRange &Other) const { in ashr()
1431 ConstantRange ConstantRange::uadd_sat(const ConstantRange &Other) const { in uadd_sat()
1440 ConstantRange ConstantRange::sadd_sat(const ConstantRange &Other) const { in sadd_sat()
1449 ConstantRange ConstantRange::usub_sat(const ConstantRange &Other) const { in usub_sat()
1458 ConstantRange ConstantRange::ssub_sat(const ConstantRange &Other) const { in ssub_sat()
1467 ConstantRange ConstantRange::umul_sat(const ConstantRange &Other) const { in umul_sat()
1476 ConstantRange ConstantRange::smul_sat(const ConstantRange &Other) const { in smul_sat()
1502 ConstantRange ConstantRange::ushl_sat(const ConstantRange &Other) const { in ushl_sat()
1511 ConstantRange ConstantRange::sshl_sat(const ConstantRange &Other) const { in sshl_sat()
1522 ConstantRange ConstantRange::inverse() const { in inverse()
1527 return ConstantRange(Upper, Lower); in inverse()
1530 ConstantRange ConstantRange::abs(bool IntMinIsPoison) const { in abs()
1544 return ConstantRange(Lo, APInt::getSignedMinValue(getBitWidth())); in abs()
1546 return ConstantRange(Lo, APInt::getSignedMinValue(getBitWidth()) + 1); in abs()
1565 return ConstantRange(-SMax, -SMin + 1); in abs()
1568 return ConstantRange(APInt::getNullValue(getBitWidth()), in abs()
1572 ConstantRange::OverflowResult ConstantRange::unsignedAddMayOverflow( in unsignedAddMayOverflow()
1573 const ConstantRange &Other) const { in unsignedAddMayOverflow()
1588 ConstantRange::OverflowResult ConstantRange::signedAddMayOverflow( in signedAddMayOverflow()
1589 const ConstantRange &Other) const { in signedAddMayOverflow()
1618 ConstantRange::OverflowResult ConstantRange::unsignedSubMayOverflow( in unsignedSubMayOverflow()
1619 const ConstantRange &Other) const { in unsignedSubMayOverflow()
1634 ConstantRange::OverflowResult ConstantRange::signedSubMayOverflow( in signedSubMayOverflow()
1635 const ConstantRange &Other) const { in signedSubMayOverflow()
1664 ConstantRange::OverflowResult ConstantRange::unsignedMulMayOverflow( in unsignedMulMayOverflow()
1665 const ConstantRange &Other) const { in unsignedMulMayOverflow()
1684 void ConstantRange::print(raw_ostream &OS) const { in print()
1694 LLVM_DUMP_METHOD void ConstantRange::dump() const { in dump()
1699 ConstantRange llvm::getConstantRangeFromMetadata(const MDNode &Ranges) { in getConstantRangeFromMetadata()
1707 ConstantRange CR(FirstLow->getValue(), FirstHigh->getValue()); in getConstantRangeFromMetadata()
1715 CR = CR.unionWith(ConstantRange(Low->getValue(), High->getValue())); in getConstantRangeFromMetadata()