Lines Matching defs:CR

99                                                    const ConstantRange &CR) {
100 if (CR.isEmptySet())
101 return CR;
103 uint32_t W = CR.getBitWidth();
108 return CR;
110 if (CR.isSingleElement())
111 return ConstantRange(CR.getUpper(), CR.getLower());
114 APInt UMax(CR.getUnsignedMax());
120 APInt SMax(CR.getSignedMax());
126 return getNonEmpty(APInt::getMinValue(W), CR.getUnsignedMax() + 1);
128 return getNonEmpty(APInt::getSignedMinValue(W), CR.getSignedMax() + 1);
130 APInt UMin(CR.getUnsignedMin());
136 APInt SMin(CR.getSignedMin());
142 return getNonEmpty(CR.getUnsignedMin(), APInt::getZero(W));
144 return getNonEmpty(CR.getSignedMin(), APInt::getSignedMinValue(W));
149 const ConstantRange &CR) {
154 return makeAllowedICmpRegion(CmpInst::getInversePredicate(Pred), CR)
557 ConstantRange ConstantRange::difference(const ConstantRange &CR) const {
558 return intersectWith(CR.inverse());
581 ConstantRange ConstantRange::intersectWith(const ConstantRange &CR,
583 assert(getBitWidth() == CR.getBitWidth() &&
587 if ( isEmptySet() || CR.isFullSet()) return *this;
588 if (CR.isEmptySet() || isFullSet()) return CR;
590 if (!isUpperWrapped() && CR.isUpperWrapped())
591 return CR.intersectWith(*this, Type);
593 if (!isUpperWrapped() && !CR.isUpperWrapped()) {
594 if (Lower.ult(CR.Lower)) {
596 // L---U : CR
597 if (Upper.ule(CR.Lower))
601 // L---U : CR
602 if (Upper.ult(CR.Upper))
603 return ConstantRange(CR.Lower, Upper);
606 // L---U : CR
607 return CR;
610 // L-------U : CR
611 if (Upper.ult(CR.Upper))
615 // L-----U : CR
616 if (Lower.ult(CR.Upper))
617 return ConstantRange(Lower, CR.Upper);
620 // L---U : CR
624 if (isUpperWrapped() && !CR.isUpperWrapped()) {
625 if (CR.Lower.ult(Upper)) {
627 // L--U : CR
628 if (CR.Upper.ult(Upper))
629 return CR;
632 // L------U : CR
633 if (CR.Upper.ule(Lower))
634 return ConstantRange(CR.Lower, Upper);
637 // L----------U : CR
638 return getPreferredRange(*this, CR, Type);
640 if (CR.Lower.ult(Lower)) {
642 // L--U : CR
643 if (CR.Upper.ule(Lower))
647 // L------U : CR
648 return ConstantRange(Lower, CR.Upper);
652 // L--U : CR
653 return CR;
656 if (CR.Upper.ult(Upper)) {
658 // --U L------ : CR
659 if (CR.Lower.ult(Upper))
660 return getPreferredRange(*this, CR, Type);
663 // --U L---- : CR
664 if (CR.Lower.ult(Lower))
665 return ConstantRange(Lower, CR.Upper);
668 // --U L-- : CR
669 return CR;
671 if (CR.Upper.ule(Lower)) {
673 // ----U L---- : CR
674 if (CR.Lower.ult(Lower))
678 // ----U L-- : CR
679 return ConstantRange(CR.Lower, Upper);
683 // ------U L-- : CR
684 return getPreferredRange(*this, CR, Type);
687 ConstantRange ConstantRange::unionWith(const ConstantRange &CR,
689 assert(getBitWidth() == CR.getBitWidth() &&
692 if ( isFullSet() || CR.isEmptySet()) return *this;
693 if (CR.isFullSet() || isEmptySet()) return CR;
695 if (!isUpperWrapped() && CR.isUpperWrapped())
696 return CR.unionWith(*this, Type);
698 if (!isUpperWrapped() && !CR.isUpperWrapped()) {
700 // L---U L---U : CR
704 if (CR.Upper.ult(Lower) || Upper.ult(CR.Lower))
706 ConstantRange(Lower, CR.Upper), ConstantRange(CR.Lower, Upper), Type);
708 APInt L = CR.Lower.ult(Lower) ? CR.Lower : Lower;
709 APInt U = (CR.Upper - 1).ugt(Upper - 1) ? CR.Upper : Upper;
717 if (!CR.isUpperWrapped()) {
719 // L--U L--U : CR
720 if (CR.Upper.ule(Upper) || CR.Lower.uge(Lower))
724 // L---------U : CR
725 if (CR.Lower.ule(Upper) && Lower.ule(CR.Upper))
729 // L---U : CR
733 if (Upper.ult(CR.Lower) && CR.Upper.ult(Lower))
735 ConstantRange(Lower, CR.Upper), ConstantRange(CR.Lower, Upper), Type);
738 // L----U : CR
739 if (Upper.ult(CR.Lower) && Lower.ule(CR.Upper))
740 return ConstantRange(CR.Lower, Upper);
743 // L-----U : CR
744 assert(CR.Lower.ule(Upper) && CR.Upper.ult(Lower) &&
746 return ConstantRange(Lower, CR.Upper);
750 // -U L----------- and ------------U L : CR
751 if (CR.Lower.ule(Upper) || Lower.ule(CR.Upper))
754 APInt L = CR.Lower.ult(Lower) ? CR.Lower : Lower;
755 APInt U = CR.Upper.ugt(Upper) ? CR.Upper : Upper;
761 ConstantRange::exactIntersectWith(const ConstantRange &CR) const {
763 ConstantRange Result = intersectWith(CR);
764 if (Result == inverse().unionWith(CR.inverse()).inverse())
770 ConstantRange::exactUnionWith(const ConstantRange &CR) const {
772 ConstantRange Result = unionWith(CR);
773 if (Result == inverse().intersectWith(CR.inverse()).inverse())
1629 ConstantRange CR = fromKnownBits(Known, /*IsSigned*/ false);
1632 return CR;
1638 CR = CR.intersectWith(Other.sub(*this), PreferredRangeType::Unsigned);
1640 CR = CR.intersectWith(this->sub(Other), PreferredRangeType::Unsigned);
1641 return CR;
2272 ConstantRange CR(FirstLow->getValue(), FirstHigh->getValue());
2280 CR = CR.unionWith(ConstantRange(Low->getValue(), High->getValue()));
2283 return CR;