Lines Matching defs:CR
98 const ConstantRange &CR) {
99 if (CR.isEmptySet())
100 return CR;
102 uint32_t W = CR.getBitWidth();
107 return CR;
109 if (CR.isSingleElement())
110 return ConstantRange(CR.getUpper(), CR.getLower());
113 APInt UMax(CR.getUnsignedMax());
119 APInt SMax(CR.getSignedMax());
125 return getNonEmpty(APInt::getMinValue(W), CR.getUnsignedMax() + 1);
127 return getNonEmpty(APInt::getSignedMinValue(W), CR.getSignedMax() + 1);
129 APInt UMin(CR.getUnsignedMin());
135 APInt SMin(CR.getSignedMin());
141 return getNonEmpty(CR.getUnsignedMin(), APInt::getZero(W));
143 return getNonEmpty(CR.getSignedMin(), APInt::getSignedMinValue(W));
148 const ConstantRange &CR) {
153 return makeAllowedICmpRegion(CmpInst::getInversePredicate(Pred), CR)
556 ConstantRange ConstantRange::difference(const ConstantRange &CR) const {
557 return intersectWith(CR.inverse());
580 ConstantRange ConstantRange::intersectWith(const ConstantRange &CR,
582 assert(getBitWidth() == CR.getBitWidth() &&
586 if ( isEmptySet() || CR.isFullSet()) return *this;
587 if (CR.isEmptySet() || isFullSet()) return CR;
589 if (!isUpperWrapped() && CR.isUpperWrapped())
590 return CR.intersectWith(*this, Type);
592 if (!isUpperWrapped() && !CR.isUpperWrapped()) {
593 if (Lower.ult(CR.Lower)) {
595 // L---U : CR
596 if (Upper.ule(CR.Lower))
600 // L---U : CR
601 if (Upper.ult(CR.Upper))
602 return ConstantRange(CR.Lower, Upper);
605 // L---U : CR
606 return CR;
609 // L-------U : CR
610 if (Upper.ult(CR.Upper))
614 // L-----U : CR
615 if (Lower.ult(CR.Upper))
616 return ConstantRange(Lower, CR.Upper);
619 // L---U : CR
623 if (isUpperWrapped() && !CR.isUpperWrapped()) {
624 if (CR.Lower.ult(Upper)) {
626 // L--U : CR
627 if (CR.Upper.ult(Upper))
628 return CR;
631 // L------U : CR
632 if (CR.Upper.ule(Lower))
633 return ConstantRange(CR.Lower, Upper);
636 // L----------U : CR
637 return getPreferredRange(*this, CR, Type);
639 if (CR.Lower.ult(Lower)) {
641 // L--U : CR
642 if (CR.Upper.ule(Lower))
646 // L------U : CR
647 return ConstantRange(Lower, CR.Upper);
651 // L--U : CR
652 return CR;
655 if (CR.Upper.ult(Upper)) {
657 // --U L------ : CR
658 if (CR.Lower.ult(Upper))
659 return getPreferredRange(*this, CR, Type);
662 // --U L---- : CR
663 if (CR.Lower.ult(Lower))
664 return ConstantRange(Lower, CR.Upper);
667 // --U L-- : CR
668 return CR;
670 if (CR.Upper.ule(Lower)) {
672 // ----U L---- : CR
673 if (CR.Lower.ult(Lower))
677 // ----U L-- : CR
678 return ConstantRange(CR.Lower, Upper);
682 // ------U L-- : CR
683 return getPreferredRange(*this, CR, Type);
686 ConstantRange ConstantRange::unionWith(const ConstantRange &CR,
688 assert(getBitWidth() == CR.getBitWidth() &&
691 if ( isFullSet() || CR.isEmptySet()) return *this;
692 if (CR.isFullSet() || isEmptySet()) return CR;
694 if (!isUpperWrapped() && CR.isUpperWrapped())
695 return CR.unionWith(*this, Type);
697 if (!isUpperWrapped() && !CR.isUpperWrapped()) {
699 // L---U L---U : CR
703 if (CR.Upper.ult(Lower) || Upper.ult(CR.Lower))
705 ConstantRange(Lower, CR.Upper), ConstantRange(CR.Lower, Upper), Type);
707 APInt L = CR.Lower.ult(Lower) ? CR.Lower : Lower;
708 APInt U = (CR.Upper - 1).ugt(Upper - 1) ? CR.Upper : Upper;
716 if (!CR.isUpperWrapped()) {
718 // L--U L--U : CR
719 if (CR.Upper.ule(Upper) || CR.Lower.uge(Lower))
723 // L---------U : CR
724 if (CR.Lower.ule(Upper) && Lower.ule(CR.Upper))
728 // L---U : CR
732 if (Upper.ult(CR.Lower) && CR.Upper.ult(Lower))
734 ConstantRange(Lower, CR.Upper), ConstantRange(CR.Lower, Upper), Type);
737 // L----U : CR
738 if (Upper.ult(CR.Lower) && Lower.ule(CR.Upper))
739 return ConstantRange(CR.Lower, Upper);
742 // L-----U : CR
743 assert(CR.Lower.ule(Upper) && CR.Upper.ult(Lower) &&
745 return ConstantRange(Lower, CR.Upper);
749 // -U L----------- and ------------U L : CR
750 if (CR.Lower.ule(Upper) || Lower.ule(CR.Upper))
753 APInt L = CR.Lower.ult(Lower) ? CR.Lower : Lower;
754 APInt U = CR.Upper.ugt(Upper) ? CR.Upper : Upper;
760 ConstantRange::exactIntersectWith(const ConstantRange &CR) const {
762 ConstantRange Result = intersectWith(CR);
763 if (Result == inverse().unionWith(CR.inverse()).inverse())
769 ConstantRange::exactUnionWith(const ConstantRange &CR) const {
771 ConstantRange Result = unionWith(CR);
772 if (Result == inverse().intersectWith(CR.inverse()).inverse())
1551 ConstantRange CR = fromKnownBits(Known, /*IsSigned*/ false);
1554 return CR;
1560 CR = CR.intersectWith(Other.sub(*this), PreferredRangeType::Unsigned);
1562 CR = CR.intersectWith(this->sub(Other), PreferredRangeType::Unsigned);
1563 return CR;
2091 ConstantRange CR(FirstLow->getValue(), FirstHigh->getValue());
2099 CR = CR.unionWith(ConstantRange(Low->getValue(), High->getValue()));
2102 return CR;