Home | History | Annotate | Download | only in IR

Lines Matching refs:CR

55                                                    const ConstantRange &CR) {
56 if (CR.isEmptySet())
57 return CR;
59 uint32_t W = CR.getBitWidth();
64 return CR;
66 if (CR.isSingleElement())
67 return ConstantRange(CR.getUpper(), CR.getLower());
70 APInt UMax(CR.getUnsignedMax());
76 APInt SMax(CR.getSignedMax());
82 APInt UMax(CR.getUnsignedMax());
88 APInt SMax(CR.getSignedMax());
94 APInt UMin(CR.getUnsignedMin());
100 APInt SMin(CR.getSignedMin());
106 APInt UMin(CR.getUnsignedMin());
112 APInt SMin(CR.getSignedMin());
121 const ConstantRange &CR) {
126 return makeAllowedICmpRegion(CmpInst::getInversePredicate(Pred), CR)
362 ConstantRange ConstantRange::difference(const ConstantRange &CR) const {
363 return intersectWith(CR.inverse());
371 ConstantRange ConstantRange::intersectWith(const ConstantRange &CR) const {
372 assert(getBitWidth() == CR.getBitWidth() &&
376 if ( isEmptySet() || CR.isFullSet()) return *this;
377 if (CR.isEmptySet() || isFullSet()) return CR;
379 if (!isWrappedSet() && CR.isWrappedSet())
380 return CR.intersectWith(*this);
382 if (!isWrappedSet() && !CR.isWrappedSet()) {
383 if (Lower.ult(CR.Lower)) {
384 if (Upper.ule(CR.Lower))
387 if (Upper.ult(CR.Upper))
388 return ConstantRange(CR.Lower, Upper);
390 return CR;
392 if (Upper.ult(CR.Upper))
395 if (Lower.ult(CR.Upper))
396 return ConstantRange(Lower, CR.Upper);
401 if (isWrappedSet() && !CR.isWrappedSet()) {
402 if (CR.Lower.ult(Upper)) {
403 if (CR.Upper.ult(Upper))
404 return CR;
406 if (CR.Upper.ule(Lower))
407 return ConstantRange(CR.Lower, Upper);
409 if (getSetSize().ult(CR.getSetSize()))
411 return CR;
413 if (CR.Lower.ult(Lower)) {
414 if (CR.Upper.ule(Lower))
417 return ConstantRange(Lower, CR.Upper);
419 return CR;
422 if (CR.Upper.ult(Upper)) {
423 if (CR.Lower.ult(Upper)) {
424 if (getSetSize().ult(CR.getSetSize()))
426 return CR;
429 if (CR.Lower.ult(Lower))
430 return ConstantRange(Lower, CR.Upper);
432 return CR;
434 if (CR.Upper.ule(Lower)) {
435 if (CR.Lower.ult(Lower))
438 return ConstantRange(CR.Lower, Upper);
440 if (getSetSize().ult(CR.getSetSize()))
442 return CR;
452 ConstantRange ConstantRange::unionWith(const ConstantRange &CR) const {
453 assert(getBitWidth() == CR.getBitWidth() &&
456 if ( isFullSet() || CR.isEmptySet()) return *this;
457 if (CR.isFullSet() || isEmptySet()) return CR;
459 if (!isWrappedSet() && CR.isWrappedSet()) return CR.unionWith(*this);
461 if (!isWrappedSet() && !CR.isWrappedSet()) {
462 if (CR.Upper.ult(Lower) || Upper.ult(CR.Lower)) {
464 APInt d1 = CR.Lower - Upper, d2 = Lower - CR.Upper;
466 return ConstantRange(Lower, CR.Upper);
467 return ConstantRange(CR.Lower, Upper);
471 if (CR.Lower.ult(L))
472 L = CR.Lower;
473 if ((CR.Upper - 1).ugt(U - 1))
474 U = CR.Upper;
482 if (!CR.isWrappedSet()) {
484 // L--U L--U : CR
485 if (CR.Upper.ule(Upper) || CR.Lower.uge(Lower))
489 // L---------U : CR
490 if (CR.Lower.ule(Upper) && Lower.ule(CR.Upper))
494 // L---U : CR
496 if (Upper.ule(CR.Lower) && CR.Upper.ule(Lower)) {
497 APInt d1 = CR.Lower - Upper, d2 = Lower - CR.Upper;
499 return ConstantRange(Lower, CR.Upper);
500 return ConstantRange(CR.Lower, Upper);
504 // L----U : CR
505 if (Upper.ult(CR.Lower) && Lower.ult(CR.Upper))
506 CR.Lower, Upper);
509 // L-----U : CR
510 assert(CR.Lower.ult(Upper) && CR.Upper.ult(Lower) &&
512 return ConstantRange(Lower, CR.Upper);
516 // -U L----------- and ------------U L : CR
517 if (CR.Lower.ule(Upper) || Lower.ule(CR.Upper))
521 if (CR.Upper.ugt(U))
522 U = CR.Upper;
523 if (CR.Lower.ult(L))
524 L = CR.Lower;