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 KnownBits ConstantRange::toKnownBits() const { in toKnownBits()
96 ConstantRange ConstantRange::makeAllowedICmpRegion(CmpInst::Predicate Pred, in makeAllowedICmpRegion()
97 const ConstantRange &CR) { in makeAllowedICmpRegion()
109 return ConstantRange(CR.getUpper(), CR.getLower()); in makeAllowedICmpRegion()
115 return ConstantRange(APInt::getMinValue(W), std::move(UMax)); in makeAllowedICmpRegion()
121 return ConstantRange(APInt::getSignedMinValue(W), std::move(SMax)); in makeAllowedICmpRegion()
131 return ConstantRange(std::move(UMin) + 1, APInt::getZero(W)); in makeAllowedICmpRegion()
137 return ConstantRange(std::move(SMin) + 1, APInt::getSignedMinValue(W)); in makeAllowedICmpRegion()
146 ConstantRange ConstantRange::makeSatisfyingICmpRegion(CmpInst::Predicate Pred, in makeSatisfyingICmpRegion()
147 const ConstantRange &CR) { in makeSatisfyingICmpRegion()
156 ConstantRange ConstantRange::makeExactICmpRegion(CmpInst::Predicate Pred, in makeExactICmpRegion()
168 bool ConstantRange::areInsensitiveToSignednessOfICmpPredicate( in areInsensitiveToSignednessOfICmpPredicate()
169 const ConstantRange &CR1, const ConstantRange &CR2) { in areInsensitiveToSignednessOfICmpPredicate()
177 bool ConstantRange::areInsensitiveToSignednessOfInvertedICmpPredicate( in areInsensitiveToSignednessOfInvertedICmpPredicate()
178 const ConstantRange &CR1, const ConstantRange &CR2) { in areInsensitiveToSignednessOfInvertedICmpPredicate()
186 CmpInst::Predicate ConstantRange::getEquivalentPredWithFlippedSignedness( in getEquivalentPredWithFlippedSignedness()
187 CmpInst::Predicate Pred, const ConstantRange &CR1, in getEquivalentPredWithFlippedSignedness()
188 const ConstantRange &CR2) { in getEquivalentPredWithFlippedSignedness()
204 void ConstantRange::getEquivalentICmp(CmpInst::Predicate &Pred, in getEquivalentICmp()
230 assert(ConstantRange::makeExactICmpRegion(Pred, RHS) == add(Offset) && in getEquivalentICmp()
234 bool ConstantRange::getEquivalentICmp(CmpInst::Predicate &Pred, in getEquivalentICmp()
241 bool ConstantRange::icmp(CmpInst::Predicate Pred, in icmp()
242 const ConstantRange &Other) const { in icmp()
247 static ConstantRange makeExactMulNUWRegion(const APInt &V) { in makeExactMulNUWRegion()
250 return ConstantRange::getFull(V.getBitWidth()); in makeExactMulNUWRegion()
252 return ConstantRange::getNonEmpty( in makeExactMulNUWRegion()
260 static ConstantRange makeExactMulNSWRegion(const APInt &V) { in makeExactMulNSWRegion()
265 return ConstantRange::getFull(BitWidth); in makeExactMulNSWRegion()
271 return ConstantRange(-MaxValue, MinValue); in makeExactMulNSWRegion()
284 return ConstantRange(Lower, Upper + 1); in makeExactMulNSWRegion()
287 ConstantRange
288 ConstantRange::makeGuaranteedNoWrapRegion(Instruction::BinaryOps BinOp, in makeGuaranteedNoWrapRegion()
289 const ConstantRange &Other, in makeGuaranteedNoWrapRegion()
338 ConstantRange ShAmt = Other.intersectWith( in makeGuaranteedNoWrapRegion()
339 ConstantRange(APInt(BitWidth, 0), APInt(BitWidth, (BitWidth - 1) + 1))); in makeGuaranteedNoWrapRegion()
358 ConstantRange ConstantRange::makeExactNoWrapRegion(Instruction::BinaryOps BinOp, in makeExactNoWrapRegion()
363 return makeGuaranteedNoWrapRegion(BinOp, ConstantRange(Other), NoWrapKind); in makeExactNoWrapRegion()
366 bool ConstantRange::isFullSet() const { in isFullSet()
370 bool ConstantRange::isEmptySet() const { in isEmptySet()
374 bool ConstantRange::isWrappedSet() const { in isWrappedSet()
378 bool ConstantRange::isUpperWrapped() const { in isUpperWrapped()
382 bool ConstantRange::isSignWrappedSet() const { in isSignWrappedSet()
386 bool ConstantRange::isUpperSignWrapped() const { in isUpperSignWrapped()
391 ConstantRange::isSizeStrictlySmallerThan(const ConstantRange &Other) const { in isSizeStrictlySmallerThan()
401 ConstantRange::isSizeLargerThan(uint64_t MaxSize) const { in isSizeLargerThan()
410 bool ConstantRange::isAllNegative() const { in isAllNegative()
420 bool ConstantRange::isAllNonNegative() const { in isAllNonNegative()
425 APInt ConstantRange::getUnsignedMax() const { in getUnsignedMax()
431 APInt ConstantRange::getUnsignedMin() const { in getUnsignedMin()
437 APInt ConstantRange::getSignedMax() const { in getSignedMax()
443 APInt ConstantRange::getSignedMin() const { in getSignedMin()
449 bool ConstantRange::contains(const APInt &V) const { in contains()
458 bool ConstantRange::contains(const ConstantRange &Other) const { in contains()
476 unsigned ConstantRange::getActiveBits() const { in getActiveBits()
483 unsigned ConstantRange::getMinSignedBits() const { in getMinSignedBits()
491 ConstantRange ConstantRange::subtract(const APInt &Val) const { in subtract()
496 return ConstantRange(Lower - Val, Upper - Val); in subtract()
499 ConstantRange ConstantRange::difference(const ConstantRange &CR) const { in difference()
503 static ConstantRange getPreferredRange( in getPreferredRange()
504 const ConstantRange &CR1, const ConstantRange &CR2, in getPreferredRange()
505 ConstantRange::PreferredRangeType Type) { in getPreferredRange()
506 if (Type == ConstantRange::Unsigned) { in getPreferredRange()
511 } else if (Type == ConstantRange::Signed) { in getPreferredRange()
523 ConstantRange ConstantRange::intersectWith(const ConstantRange &CR, in intersectWith()
545 return ConstantRange(CR.Lower, Upper); in intersectWith()
559 return ConstantRange(Lower, CR.Upper); in intersectWith()
576 return ConstantRange(CR.Lower, Upper); in intersectWith()
590 return ConstantRange(Lower, CR.Upper); in intersectWith()
607 return ConstantRange(Lower, CR.Upper); in intersectWith()
621 return ConstantRange(CR.Lower, Upper); in intersectWith()
629 ConstantRange ConstantRange::unionWith(const ConstantRange &CR, in unionWith()
648 ConstantRange(Lower, CR.Upper), ConstantRange(CR.Lower, Upper), Type); in unionWith()
656 return ConstantRange(std::move(L), std::move(U)); in unionWith()
677 ConstantRange(Lower, CR.Upper), ConstantRange(CR.Lower, Upper), Type); in unionWith()
682 return ConstantRange(CR.Lower, Upper); in unionWith()
688 return ConstantRange(Lower, CR.Upper); in unionWith()
699 return ConstantRange(std::move(L), std::move(U)); in unionWith()
702 Optional<ConstantRange>
703 ConstantRange::exactIntersectWith(const ConstantRange &CR) const { in exactIntersectWith()
705 ConstantRange Result = intersectWith(CR); in exactIntersectWith()
711 Optional<ConstantRange>
712 ConstantRange::exactUnionWith(const ConstantRange &CR) const { in exactUnionWith()
714 ConstantRange Result = unionWith(CR); in exactUnionWith()
720 ConstantRange ConstantRange::castOp(Instruction::CastOps CastOp, in castOp()
748 return ConstantRange(std::move(Min), std::move(Max)); in castOp()
759 return ConstantRange(std::move(SMin), std::move(SMax)); in castOp()
771 ConstantRange ConstantRange::zeroExtend(uint32_t DstTySize) const { in zeroExtend()
781 return ConstantRange(std::move(LowerExt), in zeroExtend()
785 return ConstantRange(Lower.zext(DstTySize), Upper.zext(DstTySize)); in zeroExtend()
788 ConstantRange ConstantRange::signExtend(uint32_t DstTySize) const { in signExtend()
796 return ConstantRange(Lower.sext(DstTySize), Upper.zext(DstTySize)); in signExtend()
799 return ConstantRange(APInt::getHighBitsSet(DstTySize,DstTySize-SrcTySize+1), in signExtend()
803 return ConstantRange(Lower.sext(DstTySize), Upper.sext(DstTySize)); in signExtend()
806 ConstantRange ConstantRange::truncate(uint32_t DstTySize) const { in truncate()
814 ConstantRange Union(DstTySize, /*isFullSet=*/false); in truncate()
826 Union = ConstantRange(APInt::getMaxValue(DstTySize),Upper.trunc(DstTySize)); in truncate()
845 return ConstantRange(LowerDiv.trunc(DstTySize), in truncate()
853 return ConstantRange(LowerDiv.trunc(DstTySize), in truncate()
860 ConstantRange ConstantRange::zextOrTrunc(uint32_t DstTySize) const { in zextOrTrunc()
869 ConstantRange ConstantRange::sextOrTrunc(uint32_t DstTySize) const { in sextOrTrunc()
878 ConstantRange ConstantRange::binaryOp(Instruction::BinaryOps BinOp, in binaryOp()
879 const ConstantRange &Other) const { in binaryOp()
923 ConstantRange ConstantRange::overflowingBinaryOp(Instruction::BinaryOps BinOp, in overflowingBinaryOp()
924 const ConstantRange &Other, in overflowingBinaryOp()
940 bool ConstantRange::isIntrinsicSupported(Intrinsic::ID IntrinsicID) { in isIntrinsicSupported()
957 ConstantRange ConstantRange::intrinsic(Intrinsic::ID IntrinsicID, in intrinsic()
958 ArrayRef<ConstantRange> Ops) { in intrinsic()
988 ConstantRange
989 ConstantRange::add(const ConstantRange &Other) const { in add()
1000 ConstantRange X = ConstantRange(std::move(NewLower), std::move(NewUpper)); in add()
1008 ConstantRange ConstantRange::addWithNoWrap(const ConstantRange &Other, in addWithNoWrap()
1019 ConstantRange Result = add(Other); in addWithNoWrap()
1035 ConstantRange
1036 ConstantRange::sub(const ConstantRange &Other) const { in sub()
1047 ConstantRange X = ConstantRange(std::move(NewLower), std::move(NewUpper)); in sub()
1055 ConstantRange ConstantRange::subWithNoWrap(const ConstantRange &Other, in subWithNoWrap()
1066 ConstantRange Result = sub(Other); in subWithNoWrap()
1085 ConstantRange
1086 ConstantRange::multiply(const ConstantRange &Other) const { in multiply()
1107 ConstantRange Result_zext = ConstantRange(this_min * Other_min, in multiply()
1109 ConstantRange UR = Result_zext.truncate(getBitWidth()); in multiply()
1133 ConstantRange Result_sext(std::min(L, Compare), std::max(L, Compare) + 1); in multiply()
1134 ConstantRange SR = Result_sext.truncate(getBitWidth()); in multiply()
1139 ConstantRange ConstantRange::smul_fast(const ConstantRange &Other) const { in smul_fast()
1158 ConstantRange
1159 ConstantRange::smax(const ConstantRange &Other) const { in smax()
1166 ConstantRange Res = getNonEmpty(std::move(NewL), std::move(NewU)); in smax()
1172 ConstantRange
1173 ConstantRange::umax(const ConstantRange &Other) const { in umax()
1180 ConstantRange Res = getNonEmpty(std::move(NewL), std::move(NewU)); in umax()
1186 ConstantRange
1187 ConstantRange::smin(const ConstantRange &Other) const { in smin()
1194 ConstantRange Res = getNonEmpty(std::move(NewL), std::move(NewU)); in smin()
1200 ConstantRange
1201 ConstantRange::umin(const ConstantRange &Other) const { in umin()
1208 ConstantRange Res = getNonEmpty(std::move(NewL), std::move(NewU)); in umin()
1214 ConstantRange
1215 ConstantRange::udiv(const ConstantRange &RHS) const { in udiv()
1235 ConstantRange ConstantRange::sdiv(const ConstantRange &RHS) const { in sdiv()
1242 ConstantRange PosFilter = in sdiv()
1244 : ConstantRange(APInt(getBitWidth(), 1), SignedMin); in sdiv()
1245 ConstantRange NegFilter(SignedMin, Zero); in sdiv()
1246 ConstantRange PosL = intersectWith(PosFilter); in sdiv()
1247 ConstantRange NegL = intersectWith(NegFilter); in sdiv()
1248 ConstantRange PosR = RHS.intersectWith(PosFilter); in sdiv()
1249 ConstantRange NegR = RHS.intersectWith(NegFilter); in sdiv()
1251 ConstantRange PosRes = getEmpty(); in sdiv()
1254 PosRes = ConstantRange(PosL.Lower.sdiv(PosR.Upper - 1), in sdiv()
1278 ConstantRange(Lo, NegL.Lower.sdiv(AdjNegRUpper - 1) + 1)); in sdiv()
1293 ConstantRange(std::move(Lo), in sdiv()
1298 ConstantRange(std::move(Lo), NegL.Lower.sdiv(NegR.Upper - 1) + 1)); in sdiv()
1302 ConstantRange NegRes = getEmpty(); in sdiv()
1305 NegRes = ConstantRange((PosL.Upper - 1).sdiv(NegR.Upper - 1), in sdiv()
1311 ConstantRange(NegL.Lower.sdiv(PosR.Lower), in sdiv()
1315 ConstantRange Res = NegRes.unionWith(PosRes, PreferredRangeType::Signed); in sdiv()
1319 Res = Res.unionWith(ConstantRange(Zero)); in sdiv()
1323 ConstantRange ConstantRange::urem(const ConstantRange &RHS) const { in urem()
1345 ConstantRange ConstantRange::srem(const ConstantRange &RHS) const { in srem()
1358 ConstantRange AbsRHS = RHS.abs(); in srem()
1378 return ConstantRange(APInt::getZero(getBitWidth()), std::move(Upper)); in srem()
1387 return ConstantRange(std::move(Lower), APInt(getBitWidth(), 1)); in srem()
1393 return ConstantRange(std::move(Lower), std::move(Upper)); in srem()
1396 ConstantRange ConstantRange::binaryNot() const { in binaryNot()
1397 return ConstantRange(APInt::getAllOnes(getBitWidth())).sub(*this); in binaryNot()
1400 ConstantRange ConstantRange::binaryAnd(const ConstantRange &Other) const { in binaryAnd()
1404 ConstantRange KnownBitsRange = in binaryAnd()
1406 ConstantRange UMinUMaxRange = in binaryAnd()
1412 ConstantRange ConstantRange::binaryOr(const ConstantRange &Other) const { in binaryOr()
1416 ConstantRange KnownBitsRange = in binaryOr()
1419 ConstantRange UMaxUMinRange = in binaryOr()
1425 ConstantRange ConstantRange::binaryXor(const ConstantRange &Other) const { in binaryXor()
1442 ConstantRange
1443 ConstantRange::shl(const ConstantRange &Other) const { in shl()
1473 return ConstantRange::getNonEmpty(std::move(Min), std::move(Max) + 1); in shl()
1476 ConstantRange
1477 ConstantRange::lshr(const ConstantRange &Other) const { in lshr()
1486 ConstantRange
1487 ConstantRange::ashr(const ConstantRange &Other) const { in ashr()
1537 ConstantRange ConstantRange::uadd_sat(const ConstantRange &Other) const { in uadd_sat()
1546 ConstantRange ConstantRange::sadd_sat(const ConstantRange &Other) const { in sadd_sat()
1555 ConstantRange ConstantRange::usub_sat(const ConstantRange &Other) const { in usub_sat()
1564 ConstantRange ConstantRange::ssub_sat(const ConstantRange &Other) const { in ssub_sat()
1573 ConstantRange ConstantRange::umul_sat(const ConstantRange &Other) const { in umul_sat()
1582 ConstantRange ConstantRange::smul_sat(const ConstantRange &Other) const { in smul_sat()
1603 ConstantRange ConstantRange::ushl_sat(const ConstantRange &Other) const { in ushl_sat()
1612 ConstantRange ConstantRange::sshl_sat(const ConstantRange &Other) const { in sshl_sat()
1623 ConstantRange ConstantRange::inverse() const { in inverse()
1628 return ConstantRange(Upper, Lower); in inverse()
1631 ConstantRange ConstantRange::abs(bool IntMinIsPoison) const { in abs()
1645 return ConstantRange(Lo, APInt::getSignedMinValue(getBitWidth())); in abs()
1647 return ConstantRange(Lo, APInt::getSignedMinValue(getBitWidth()) + 1); in abs()
1666 return ConstantRange(-SMax, -SMin + 1); in abs()
1669 return ConstantRange(APInt::getZero(getBitWidth()), in abs()
1673 ConstantRange::OverflowResult ConstantRange::unsignedAddMayOverflow( in unsignedAddMayOverflow()
1674 const ConstantRange &Other) const { in unsignedAddMayOverflow()
1689 ConstantRange::OverflowResult ConstantRange::signedAddMayOverflow( in signedAddMayOverflow()
1690 const ConstantRange &Other) const { in signedAddMayOverflow()
1719 ConstantRange::OverflowResult ConstantRange::unsignedSubMayOverflow( in unsignedSubMayOverflow()
1720 const ConstantRange &Other) const { in unsignedSubMayOverflow()
1735 ConstantRange::OverflowResult ConstantRange::signedSubMayOverflow( in signedSubMayOverflow()
1736 const ConstantRange &Other) const { in signedSubMayOverflow()
1765 ConstantRange::OverflowResult ConstantRange::unsignedMulMayOverflow( in unsignedMulMayOverflow()
1766 const ConstantRange &Other) const { in unsignedMulMayOverflow()
1785 void ConstantRange::print(raw_ostream &OS) const { in print()
1795 LLVM_DUMP_METHOD void ConstantRange::dump() const { in dump()
1800 ConstantRange llvm::getConstantRangeFromMetadata(const MDNode &Ranges) { in getConstantRangeFromMetadata()
1808 ConstantRange CR(FirstLow->getValue(), FirstHigh->getValue()); in getConstantRangeFromMetadata()
1816 CR = CR.unionWith(ConstantRange(Low->getValue(), High->getValue())); in getConstantRangeFromMetadata()