return Lower == Upper && Lower.isMinValue();
}
-bool ConstantRange::isWrappedSet() const {
+bool ConstantRange::isUpperWrapped() const {
return Lower.ugt(Upper);
}
}
APInt ConstantRange::getUnsignedMax() const {
- if (isFullSet() || isWrappedSet())
+ if (isFullSet() || isUpperWrapped())
return APInt::getMaxValue(getBitWidth());
return getUpper() - 1;
}
APInt ConstantRange::getUnsignedMin() const {
- if (isFullSet() || (isWrappedSet() && !getUpper().isNullValue()))
+ if (isFullSet() || (isUpperWrapped() && !getUpper().isNullValue()))
return APInt::getMinValue(getBitWidth());
return getLower();
}
if (Lower == Upper)
return isFullSet();
- if (!isWrappedSet())
+ if (!isUpperWrapped())
return Lower.ule(V) && V.ult(Upper);
return Lower.ule(V) || V.ult(Upper);
}
if (isFullSet() || Other.isEmptySet()) return true;
if (isEmptySet() || Other.isFullSet()) return false;
- if (!isWrappedSet()) {
- if (Other.isWrappedSet())
+ if (!isUpperWrapped()) {
+ if (Other.isUpperWrapped())
return false;
return Lower.ule(Other.getLower()) && Other.getUpper().ule(Upper);
}
- if (!Other.isWrappedSet())
+ if (!Other.isUpperWrapped())
return Other.getUpper().ule(Upper) ||
Lower.ule(Other.getLower());
if ( isEmptySet() || CR.isFullSet()) return *this;
if (CR.isEmptySet() || isFullSet()) return CR;
- if (!isWrappedSet() && CR.isWrappedSet())
+ if (!isUpperWrapped() && CR.isUpperWrapped())
return CR.intersectWith(*this);
- if (!isWrappedSet() && !CR.isWrappedSet()) {
+ if (!isUpperWrapped() && !CR.isUpperWrapped()) {
if (Lower.ult(CR.Lower)) {
if (Upper.ule(CR.Lower))
return getEmpty();
return getEmpty();
}
- if (isWrappedSet() && !CR.isWrappedSet()) {
+ if (isUpperWrapped() && !CR.isUpperWrapped()) {
if (CR.Lower.ult(Upper)) {
if (CR.Upper.ult(Upper))
return CR;
if ( isFullSet() || CR.isEmptySet()) return *this;
if (CR.isFullSet() || isEmptySet()) return CR;
- if (!isWrappedSet() && CR.isWrappedSet()) return CR.unionWith(*this);
+ if (!isUpperWrapped() && CR.isUpperWrapped()) return CR.unionWith(*this);
- if (!isWrappedSet() && !CR.isWrappedSet()) {
+ if (!isUpperWrapped() && !CR.isUpperWrapped()) {
if (CR.Upper.ult(Lower) || Upper.ult(CR.Lower)) {
// If the two ranges are disjoint, find the smaller gap and bridge it.
APInt d1 = CR.Lower - Upper, d2 = Lower - CR.Upper;
return ConstantRange(std::move(L), std::move(U));
}
- if (!CR.isWrappedSet()) {
+ if (!CR.isUpperWrapped()) {
// ------U L----- and ------U L----- : this
// L--U L--U : CR
if (CR.Upper.ule(Upper) || CR.Lower.uge(Lower))
unsigned SrcTySize = getBitWidth();
assert(SrcTySize < DstTySize && "Not a value extension");
- if (isFullSet() || isWrappedSet()) {
+ if (isFullSet() || isUpperWrapped()) {
// Change into [0, 1 << src bit width)
APInt LowerExt(DstTySize, 0);
if (!Upper) // special case: [X, 0) -- not really wrapping around
// Analyze wrapped sets in their two parts: [0, Upper) \/ [Lower, MaxValue]
// We use the non-wrapped set code to analyze the [Lower, MaxValue) part, and
// then we do the union with [MaxValue, Upper)
- if (isWrappedSet()) {
+ if (isUpperWrapped()) {
// If Upper is greater than or equal to MaxValue(DstTy), it covers the whole
// truncated range.
if (Upper.getActiveBits() > DstTySize ||
// from one positive number to another which is as good as we can generate.
// In this case, skip the extra work of generating signed ranges which aren't
// going to be better than this range.
- if (!UR.isWrappedSet() &&
+ if (!UR.isUpperWrapped() &&
(UR.getUpper().isNonNegative() || UR.getUpper().isMinSignedValue()))
return UR;
EXPECT_TRUE(Full.isFullSet());
EXPECT_FALSE(Full.isEmptySet());
EXPECT_TRUE(Full.inverse().isEmptySet());
- EXPECT_FALSE(Full.isWrappedSet());
+ EXPECT_FALSE(Full.isUpperWrapped());
EXPECT_TRUE(Full.contains(APInt(16, 0x0)));
EXPECT_TRUE(Full.contains(APInt(16, 0x9)));
EXPECT_TRUE(Full.contains(APInt(16, 0xa)));
EXPECT_FALSE(Empty.isFullSet());
EXPECT_TRUE(Empty.isEmptySet());
EXPECT_TRUE(Empty.inverse().isFullSet());
- EXPECT_FALSE(Empty.isWrappedSet());
+ EXPECT_FALSE(Empty.isUpperWrapped());
EXPECT_FALSE(Empty.contains(APInt(16, 0x0)));
EXPECT_FALSE(Empty.contains(APInt(16, 0x9)));
EXPECT_FALSE(Empty.contains(APInt(16, 0xa)));
EXPECT_FALSE(One.isFullSet());
EXPECT_FALSE(One.isEmptySet());
- EXPECT_FALSE(One.isWrappedSet());
+ EXPECT_FALSE(One.isUpperWrapped());
EXPECT_FALSE(One.contains(APInt(16, 0x0)));
EXPECT_FALSE(One.contains(APInt(16, 0x9)));
EXPECT_TRUE(One.contains(APInt(16, 0xa)));
EXPECT_FALSE(Some.isFullSet());
EXPECT_FALSE(Some.isEmptySet());
- EXPECT_FALSE(Some.isWrappedSet());
+ EXPECT_FALSE(Some.isUpperWrapped());
EXPECT_FALSE(Some.contains(APInt(16, 0x0)));
EXPECT_FALSE(Some.contains(APInt(16, 0x9)));
EXPECT_TRUE(Some.contains(APInt(16, 0xa)));
EXPECT_FALSE(Wrap.isFullSet());
EXPECT_FALSE(Wrap.isEmptySet());
- EXPECT_TRUE(Wrap.isWrappedSet());
+ EXPECT_TRUE(Wrap.isUpperWrapped());
EXPECT_TRUE(Wrap.contains(APInt(16, 0x0)));
EXPECT_TRUE(Wrap.contains(APInt(16, 0x9)));
EXPECT_FALSE(Wrap.contains(APInt(16, 0xa)));